Complete the code to import the path module in Node.js.
const path = require('[1]');
The path module is built into Node.js and is imported using require('path').
Complete the code to join directory 'folder' and file 'file.txt' into a path.
const fullPath = path.[1]('folder', 'file.txt');
resolve which resolves to an absolute path.basename which returns the last part of a path.path.join combines path segments into a single path string, handling separators correctly for the operating system.
Fix the error in the code to join 'dir' and 'file.txt' correctly.
const fullPath = path.[1]('dir', 'file.txt');
basename or dirname incorrectly.Using path.join with separate arguments is correct. Concatenating strings manually can cause issues on different OS.
Fill both blanks to join 'folder', 'subfolder', and 'file.txt' into a path.
const fullPath = path.[1]('folder', [2], 'file.txt');
resolve instead of join.path.join is used to combine path parts. The second argument should be the string 'subfolder'.
Fill all three blanks to join 'home', 'user', and 'docs' into a path.
const fullPath = path.[1]('[2]', '[3]', 'docs');
resolve instead of join.Use path.join to combine the parts. The strings 'home' and 'user' are the folder names.