Demonstrate the functionalities of the path module.
Mon Apr 07 2025 23:57:30 GMT+0000 (Coordinated Universal Time)
Saved by
@p9876543
const path = require('path');
const filePath = '/users/student/projects/app/index.js';
console.log('Directory Name:', path.dirname(filePath));
console.log('Base Name:', path.basename(filePath));
console.log('Extension Name:', path.extname(filePath));
console.log('Join Paths:', path.join('/users', 'student', 'docs'));
console.log('Resolve Path:', path.resolve('app', 'index.js'));
console.log('Is Absolute:', path.isAbsolute(filePath));
content_copyCOPY
Comments