What is a code block? What are some examples of a code block?
- if/else, for, do while, while, try, catch, etc
What does block scope mean?
- things that happen inside the curbraces
What is the scope of a variable declared with const or let?
block-scope
What is the difference between let and const?
Why is it possible to .push() a new value into a const variable that points to an Array?
How should you decide on which type of declaration to use?
is the whole variable being reassigned (let), or are just the values inside the variable changing (const)
arrays & objects, always CONST
What is the syntax for writing a template literal?
backticks: this is a template literal
What is “string interpolation”?
imbedding variables & expressions in a string and JS automatically replacing them with their values
it looks like ${variable_name} this
__code read: ___
const bio = My name is ${firstName} ${lastName} and I am ${age} years old.;
there is a template literal string with the substitutions firstName, lastName, and age, being assigned to the const bio
What is destructuring, conceptually?
What is the syntax for Object destructuring?
let { propertyName: variableName, propertyName: variableName } = sourceObject;
so ‘sourceObject.propertyName’ is now ‘variableName’ for ease of use
Object destructuring assigns the properties of an object to variables with the same names by default.
What is the syntax for Array destructuring?
let [var, for, each, index] = scrArray/srcFunc()
How can you tell the difference between destructuring and creating Object/Array literals?
assignment is inverted
creating, on the right
destructuring, on the left
code read:
const { title, author, libraryID } = book1;
const { title: eek, author: barba, libraryID: durkle } = book2;
the const title, author, libraryID are being destructured from book1
the const title is being aliased with eek … being destructured from boook2
What is the syntax for defining an arrow function?
parameter list, arrow, codeblock
let funcName = (parameter) => { return expression; };
When an arrow function’s body is left without curly braces, what changes in its functionality?
How is the value of THIS determined within an arrow function?
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 in this exercise.
man – interface to the online reference manuals
cat – concat files & print to standard output, but rly for viewing file contents
_cat filename -quickly see the contents of a file
ls – list directories
pwd – print working directory
echo – display a line of text
touch – change file timestamps, but rly for creating empty files
_touch empty-file.txt -create an epmty file
mkdir – make directories
mv – move (rename) files
rm – remove files/directories
cp – copy files/directories
What are the three virtues of a great programmer?
What is Node.js?
What can Node.js be used for?
building servers or backends for web applications
What is a REPL?
Read–eval–print loop
A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user.