Valid JS-Dev-101 Dumps shared by EduDump.com for Helping Passing JS-Dev-101 Exam! EduDump.com now offer the newest JS-Dev-101 exam dumps, the EduDump.com JS-Dev-101 exam questions have been updated and answers have been corrected get the newest EduDump.com JS-Dev-101 dumps with Test Engine here:
A developer is setting up a Node.js server and is creating a script at the root of the source code, index.js, that will start the server when executed. The developer declares a variable that needs the folder location that the code executes from. Which global variable can be used in the script?
Correct Answer: D
In Node.js: __filename is the absolute path to the current file (including file name). __dirname is the absolute path to the directory that contains the current file. window.location is a browser-only global, not available in Node.js. this.path is not a standard Node.js global for path information. The requirement is: "the folder location that the code executes from." That is exactly what __dirname provides. So the correct choice is __dirname. Concepts: Node.js globals, __filename, __dirname, Node vs browser environment.