Complete the code to import the Node.js path module.
const path = require('[1]');
The path module is used to handle file paths in Node.js. Importing it with require('path') allows you to use its functions.
Complete the code to join directory and file name into a path.
const fullPath = path.[1]('folder', 'file.txt');
basename which returns the last part of a path.extname which returns the file extension.The join method combines path segments into one path string, handling separators correctly.
Fix the error in the code to get the file extension.
const ext = path.[1]('index.html');
basename which returns the file name.dirname which returns the directory path.The extname method returns the file extension from a path string.
Fill both blanks to get the directory name and base file name from a path.
const dir = path.[1]('/home/user/file.txt'); const base = path.[2]('/home/user/file.txt');
basename and dirname.extname instead of basename.dirname returns the directory part of the path, and basename returns the file name.
Fill all three blanks to normalize a path, get its absolute path, and extract the extension.
const normalized = path.[1]('folder//subfolder/../file.txt'); const absolute = path.[2](normalized); const extension = path.[3](absolute);
basename instead of extname for extension.normalize cleans up the path, resolve makes it absolute, and extname gets the file extension.