Senior Side Flashcards
What is a code block? What are some examples of a code block?
denoted by braces.
function definitions
conditional blocks
loop blocks
What does block scope mean?
declaring a variable inside the code block
variables only exist inside that block
What is the scope of a variable declared with const or let?
block scope
What is the difference between let and const?
let variables can have values reassigned but the variable itself cannot be redeclared to another name. Const variables can’t be reassigned and redeclared.
Why is it possible to .push() a new value into a const variable that points to an Array?
only the reference cannot be changed but the value itself can be changed
How should you decide on which type of declaration to use?
if you are going to be reassigning the variable then use let and if not then use const
What is the syntax for writing a template literal?
backticks and any variable or expression inside ${}
What is “string interpolation”?
substitute an expression or variable into a template literal
What is destructuring, conceptually?
unpacking values from arrays and assigning them into variables
What is the syntax for Object destructuring?
variable declaration curly braces property keys equal sign and object being destructed
What is the syntax for Array destructuring?
variable declaration square brackets elements and array being destructured
How can you tell the difference between destructuring and creating Object/Array literals?
destructuring happens on the left side
creating happens on the right side
What is the syntax for defining an arrow function?
( => {} )
When an arrow function’s body is left without curly braces, what changes in its functionality?
doesn’t need a return keyword
implicit return
How is the value of this determined within an arrow function?
at definition time
What is a CLI?
command line interface
What is a GUI?
graphical user interface
Give at least one use case for each of the commands listed. man cat ls pwd echo touch mkdir mv rm cp
man - look at manual cat - concatenate files or print output ls - list directory contents pwd - print working directory echo - display line of text touch - change file timestamps mkdir - make directories mv - move (rename) files rm - remove files cp - copy files and directories
What are the three virtues of a great programmer?
laziness, anger, hubris
What is Node.js?
javascript environment where you can run code outside of the browser
What can Node.js be used for?
build back end for Web applications, command-line programs, or any kind of automation that developers wish to perform
What is a REPL?
Read–eval–print loop
reads input, evals input, and prints
When was Node.js created?
2009
What back end languages have you heard of?
Java, C, C++, Python, C#, Ruby
What is a computer process?
a single program running on your computer
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
a lot. around 300
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, so having at least a cursory awareness of computer processes is necessary
What is the process object in a Node.js program?
an object 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 is a global variable
What is the data type of process.argv in Node.js?
array of strings
What is a JavaScript module?
a single .js file
What values are passed into a Node.js module’s local scope?
exports, require, module, __filename, __dirname
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?
tells you what code can be accessed by other files
How do you import functionality into a Node.js module from another Node.js module?
require function with the the file name and a ./ in front which indicates look at the current
What is the JavaScript Event Loop?
event loop is a process that keeps running and checks whether the call stack is empty or not. If the call stack is empty, it pushed the first item of the message queue into the call stack for execution
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking code is code that is currently blocking the call stack
What is a directory?
a folder. a collection of files
What is a relative file path?
points to a file relative to the current page.
What is an absolute file path?
the full URL to a 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?
writeFile method
Are file operations using the fs module synchronous or asynchronous?
they’re both synch and asynch
What is a client?
piece of computer hardware or software that accesses a service made available by a server as part of the client–server model of computer networks