Complete the code to print the current working directory using Node.js.
console.log([1]());The process.cwd() function returns the current working directory of the Node.js process.
Complete the code to print the directory name of the current module file.
console.log([1]);The __dirname variable holds the directory path of the current module file.
Fix the error in the code to correctly print the current working directory.
console.log(process.[1]);process.cwd() is a function and must be called with parentheses to get the current working directory.
Fill both blanks to create an absolute path to a file named 'data.txt' in the current module's directory.
const path = require('path'); const filePath = path.join([1], [2]); console.log(filePath);
Use __dirname to get the current module's directory and join it with the filename 'data.txt' to get the absolute path.
Fill both blanks to create a function that returns the absolute path of a file given its name, relative to the current module's directory.
const path = require('path'); function getFilePath(filename) { return path.join([1], [2], filename,); }
The function joins __dirname, a subfolder 'src', and the filename. The commas separate the arguments in path.join.