Senior Side Flashcards
What is a code block? What are some examples of a code block?
{ } ; functions, loops, conditionals
What does block scope mean?
only variables within the block are avalible to use
What is the scope of a variable declared with const or let?
block scope
What is the difference between let and const?
let can be reassigned; const cannot
Why is it possible to .push() a new value into a const variable that points to an Array?
Since the value of const is still the same array just changing the contents within
How should you decide on which type of declaration to use?
Use const first then decide if let it needed
What is destructuring, conceptually?
unpack values from array/properties into distinct variables
What is the syntax for Object destructuring?
const/let {propKeys: (new name) = objectName (from which object) }
What is the syntax for Array destructuring?
const/let [propKeys: (new name) = arrayName (from which array) ]
How can you tell the difference between destructuring and creating Object/Array literals?
Which side is the = on
What is the syntax for writing a template literal?
use ` ` and ${ } for variables (instead of concatenation)
What is “string interpolation”?
Using ${ } for variables
What is the syntax for defining an arrow function?
(parameters) => { } OR () => {}
When an arrow function’s body is left without curly braces, what changes in its functionality?
Automatically returns expression
How is the value of this determined within an arrow function?
enclosing scope; defined w/in function definition (usually at function call)
What is Node.js?
asynchronous event driven JS routine; executes JS outside the browser
What can Node.js be used for?
designed to build scalable network apps (command / http servers/clients)
What is a REPL?
Read-Event-Print loop
When was Node.js created?
2009
What is a CLI?
Command Line Interface
What is a GUI?
graphical user interface
What does the “man” command do?
the manual for other commands
What does the “cat” command do?
reads the file and can combine files
ls command?
list directory contents (-a for all -classify)
pwd command?
print name of current working directory
echo command?
display a line of text
touch command?
if it exists, update the file timestamp or else, create it
mkdir command?
make directory (-parents)
mv command?
move (rename) files
rm command?
remove files (-f force)
cp command?
copy files & directories
What is a computer process?
a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.
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.
How do you access the process object in a Node.js program?
process.argv[]
What is the data type of process.argv in Node.js?
An array
What is a JavaScript module?
seprate JavaScript files
What values are passed into a Node.js module’s local scope?
__dirname, __filename, exports, module, require()
What is the purpose of module.exports in a Node.js module?
export code (a module) to another file; make avalible to other modules
How do you import functionality into a Node.js module from another Node.js module?
require()
What is the JavaScript Event Loop?
takes callbacks from callback que & puts it back into the stack after everything else has ran
What is different between “blocking” and “non-blocking” with respect to how code is executed?
how code sits in the stack. Blocking need to finish before other can run. Non-blocking runs after the stack is clear
What is a directory?
file system (folder)
What is a relative file path?
points to a file relative to the page
What is an absolute file path?
a full URL to a different file
What module does Node.js include for manipulating the file system?
‘fs’