node Flashcards
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser
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./ as a back end api/ to make programs that run on the command line/ or any desktop program/ almost any area of programming
What is a REPL?
read–eval–print loop (REPL),
is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user another existing tool would be an ineractive coding inviroment like the chrome console.
node js can be ran as a REPL in ineractive mode
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
python,Java,c++
What is a computer process?
the instance(copy) of a computer program that is being executed by one or many threads(a program that is bein runned)
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
7
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, This will be extremely important when learning about applications made of multiple components, such as clients, servers, and databases.
What is the process object in a Node.js program?
The process object is a global object that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require().
it has many events that can be used to
How do you access the process object in a Node.js program?
it can also be explicitly accessed using require():
and it is always available to Node.js applications without using require(). I
What is the data type of process.argv in Node.js?
array with string elements
What is a JavaScript module?
- In JavaScript, a “module” is a single .js file.
2. they each have module scope meaning its data is only available within that module
What values are passed into a Node.js module’s local scope?
exports/required/moduele/___filename/___dirname
What is a JavaScript module?
A module in JavaScript is just a file containing related code.
Give two examples of truly global variables in a Node.js program.
process/ console/ setTimeout
What is the purpose of module.exports in a Node.js module?
The export statement is used when you want to house the things that are ,ade available to other modules like functions objects variables etc.
How do you import functionality into a Node.js module from another Node.js module?
that can be with both require for the common js method require var exampleBlah = require('./example.js')
and import but thats for module 3, it was not available to node until later on
What is the JavaScript Event Loop?
the event loop is the loop that passes whatever is in the event que into the stack once the after the stack is empty
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking is any code that blocks further execution until that operation is completed, while none blocking does not block other executions
What is a directory?
its a folder that houses the list of file names that it contains and it points to those individual files
What is a relative file path?
it is a path to a file relative to the current directory/folder that starts with just its name
EXAMPLE: somedirectory/someotherfile.js
What is an absolute file path?
the entire URL to a file from the root of the file system it starts with a /
EXAMPLE: /HOME/USERNAME/SOMEDIRECTORY/SOMEFILE.JS
What module does Node.js include for manipulating the file system?
the ‘fs’ module
What method is available in the Node.js fs module for writing data to a file?
writeFile method
Are file operations using the fs module synchronous or asynchronous?
asynchronous