What is Node.js?
What can Node.js be used for?
It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.
Takes input, evaluates it, prints output, and goes back to beginning like the console.
When was Node.js created?
What back end languages have you heard of?
What is a computer process?
A program that is running on your computer. This can be anything from a small background task, such as a spell-checker or system events handler to a full-blown application like Internet Explorer or Microsoft Word. All processes are composed of one or more threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
540 on mine.
What is the process object in a Node.js program?
The process object is the global object in Node. It can be accessed from anywhere; it is an instance of EventEmitter. Each Node.js has a set of built-in functionality, accessible through the global process object.
How do you access the process object in a Node.js program?
It is global so you can just type it.
What is the data type of process.argv in Node.js?
Array of strings.
What values are passed into a Node.js module’s local scope?
\_\_dirname \_\_filename exports module require( )
Give two examples of truly global variables in a Node.js program.
process and console.
What is the purpose of module.exports in a Node.js module?
To export some code to another Node.js module.
How do you import functionality into a Node.js module from another Node.js module?
const variable = require(file-path)
Ex: const addFunction = require('./add');
What is different between “blocking” and “non-blocking” with respect to how code is executed?
“blocking”: waits for execution to complete before moving to the next call-stack. Synchronous
“non-blocking”: does not wait for execution to complete before moving the the next call-stack. Asynchronous
What is a directory?
Folder/collection for files.
What is a relative file path?
The path with reference to current directory.
What is an absolute file path?
The path with reference to the root directory.
What module does Node.js include for manipulating the file system?
What method is available in the Node.js fs module for writing data to a file?
Are file operations using the fs module synchronous or asynchronous?
Both synchronous and asynchronous
readfile and readfile sync
How are ES Modules different from CommonJS modules?
Their syntax is even more compact than CommonJS’s.
Their structure can be statically analyzed (for static checking, optimization, etc.).
Their support for cyclic dependencies is better than CommonJS’s.
Use import instead of require
Use export instead of module.exports