node Flashcards
What is Node.js?
JavaScript outside of a browser.
What can Node.js be used for?
build backend
What is a REPL?
read eval print loop. Browser console is a REPL. interactive shell that processes node.js expressions.
When was Node.js created?
May 27th, 2009 by Ryan Dahl
What back end languages have you heard of?
Python, PHP, Perl, JavaScript, Lua
What is a computer process?
the instance of a computer program that is being executed by one or many threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
500
Why should a full stack Web developer know that computer processes exist?
Full stack Web development is based on making multiple processes work together to form one application. Important to know that application has many parts.
What is the process object in a Node.js program?
the process object is a global that provides information about, and control over, the current Node.js process. JavaScript object that is a model of Node Js computer process.
How do you access the process object in a Node.js program?
Just process because it is global
What is the data type of process.argv in Node.js?
an array of strings
What is a JavaScript module?
a single ‘.js’ file. Modules are way to split an application into separate files instead of having all your application in one file. Allows you to establish values that you want to use on other modules.
What values are passed into a Node.js module’s local scope?
__filename, __dirname, exports, module, require
Give two examples of truly global variables in a Node.js program.
console, process, url.
What is the purpose of module.exports in a Node.js module?
so that you can reuse that function in other modules. you are exporting that to somewhere else.
How do you import functionality into a Node.js module from another Node.js module?
using require function and relative url to .
What is the JavaScript Event Loop?
If the stack is empty, it takes the first task on the queue and pushes it on to the stack. System of managing JavaScript workloads. Looks to see if call stack is busy, if there is something in call stack does nothing. looks at queue stack and if there is a task, pushes that to call stack.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn’t block execution. blocking means whatever is occupying the call stack (async). non-blocking means sync.
What is a directory?
file system used to control how data is stored and retrieved. File that lists other files.
What is a relative file path?
file path relative to the current file.
What is an absolute file path?
full url to a file. file path starting from the root file to specific file.
What module does Node.js include for manipulating the file system?
fs module
What method is available in the Node.js fs module for writing data to a file?
js.writeFile
Are file operations using the fs module synchronous or asynchronous?
asynchronous