Recall & Review
beginner
What is the main environment difference between Node.js and browser JavaScript?
Node.js runs JavaScript on the server side outside the browser, while browser JavaScript runs inside the web browser on the client side.
Click to reveal answer
beginner
Which global object is used in Node.js instead of 'window' in browsers?
Node.js uses the 'global' object as the global scope, unlike browsers which use the 'window' object.
Click to reveal answer
intermediate
Can Node.js access the file system directly? Why or why not?
Yes, Node.js can access the file system directly using built-in modules like 'fs' because it runs on the server with system access, unlike browser JavaScript which is sandboxed for security.
Click to reveal answer
intermediate
How does Node.js handle modules compared to browser JavaScript?
Node.js uses CommonJS or ES Modules to organize code into files and packages, while browsers traditionally did not support modules but now support ES Modules natively with different loading behavior.
Click to reveal answer
intermediate
Why can't browser JavaScript use Node.js built-in modules like 'http' or 'fs'?
Browser JavaScript cannot use Node.js built-in modules because browsers restrict access to system resources for security, and those modules rely on server-side capabilities not available in browsers.
Click to reveal answer
Which object represents the global scope in Node.js?
✗ Incorrect
Node.js uses 'global' as the global object, unlike browsers which use 'window'.
Can Node.js directly read and write files on your computer?
✗ Incorrect
Node.js can access the file system directly using modules like 'fs' because it runs on the server.
Which environment runs JavaScript inside a web browser?
✗ Incorrect
Browser JavaScript runs inside the web browser on the client side.
Why can't browser JavaScript use Node.js modules like 'http'?
✗ Incorrect
Browsers restrict access to system resources for security, so Node.js modules that require system access cannot run in browsers.
Which module system is commonly used in Node.js?
✗ Incorrect
Node.js commonly uses CommonJS modules, though it also supports ES Modules.
Explain three key differences between Node.js and browser JavaScript environments.
Think about where the code runs and what it can access.
You got /3 concepts.
Describe why Node.js can use modules like 'fs' and 'http' but browser JavaScript cannot.
Consider security and environment restrictions.
You got /3 concepts.