Week 8 and Week 9 Quiz Questions Flashcards
What is a code block? What are some examples of a code block?
lines of code used in and denoted by curly braces {} often used in if statements, for loops, do while loops, etc
What does block scope mean?
in block scope, variables and other items/ objects are only referenced within the block itself, and thus have no effect on the global scale or other codes blocks in a function.
What is the scope of a variable declared with const or let?
both are block level
What is the difference between let and const?
const is immutable and cannot be changed– it is read-only.
Why is it possible to .push() a new value into a const variable that points to an Array?
values of const variables can change, but the const variable cannot directly be edited(array is referenced datatype and not a primitive (that cannot be changed))
How should you decide on which type of declaration to use?
look at scope first, then think about if variables can just be read-only and never changed vs if variable can/ needs to be changed
What is the syntax for writing a template literal?
use backticks (`) instead of quotation
variables called by using ${variableName} inside backticks
What is “string interpolation”?
substituting part of a string for the value of a variable or expression
What is destructuring, conceptually?
being able to assign component parts of arrays and objects into variables
What is the syntax for Object destructuring?
const {variable1, variable2} = object;
OR
const {prop1: variable1, prop2: variable2} = object;
What is the syntax for Array destructuring?
const [variable1, variable2] = array;
How can you tell the difference between destructuring and creating Object/Array literals?
brackets come first before equals sign
What is the syntax for defining an arrow function?
const variableName = (parameter1, parameter2) => {function code block}
When an arrow function’s body is left without curly braces, what changes in its functionality?
return is implied. only one expression (line) is read as well
How is the value of this determined within an arrow function?
this is defined at definition time not call time in arrow functions.
this in arrow functions
this in arrow functions reference the relative object they are in. (as opposed to this being the window object) DIRECT PARENT
What is a CLI?
`
command line interfaces
What is a GUI?
graphical user interface
What are the 3 components of a fullstack Web architecture?
The frontend that the user interacts with (Web site or Mobile app)
The backend server that takes requests from the frontend and processes them
The database where data is stored and used across all instances of the frontend
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 backends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
read-evaluate-print loop
When was Node.js created?
May 27, 2009
What backend languages have you heard of?
python, java