JavaScript (Senior Side) Flashcards
(134 cards)
What is a code block? What are some examples of a code block?
a structure that consists of one or more declarations and statements. I.e. function code block, conditional code block, loop code block.
What does block scope mean?
Anything within the code block can only be accessed within the code block.
What is the scope of a variable declared with const or let?
block
What is the difference between let and const?
The value of const can’t be changed through reassignment and it can’t be redeclared.
The value of let can be changed through reassignment and it can be redeclared.
Why is it possible to .push() a new value into a const variable that points to an Array?
Because if const is an arrray or an object, its properties or items can be updated or removed.
How should you decide on which type of declaration to use? (Const or let)
Consider whether or not the value of the variable will need to be changed in the future.
What is the syntax for writing a template literal?
backticks ( ` ` )
use $ { } to insert variables
What is “string interpolation”?
the ability to substitute part of the string for the values of variables or expressions.
When an arrow function’s body is left without curly braces, what changes in its functionality?
It can only return one expression
What is destructuring, conceptually?
a syntax that allows us to get specific properties of an object and store them in a variable
What is the syntax for Object destructuring?
const { value } = variable
What is a CLI?
Command Line Interface
What is the syntax for Array destructuring?
const [array] = variable
How can you tell the difference between destructuring and creating Object/Array literals?
the operands are reversed
What is the syntax for defining an arrow function?
(param) => {
}
How is the value of this determined within an arrow function?
It captures the value of the enclosing context instead of creating its own this context.
What are the three virtues of a great programmer?
Laziness
Impatience
Hubris
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of the web browser.
What can Node.js be used for?
1.back ends for Web applications
2.command-line programs
3.any kind of automation that developers wish to perform.
What is a REPL?
Read-Eval-Print-Loop. it is an interactive shell that processes Node. js expressions.
When was Node.js created?
May 27, 2009
What is the process object in a Node.js program?
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?
type out the process variable
What is the data type of process.argv in Node.js?
array