ES6 Flashcards
What is a code block? What are some examples of a code block?
Code within {}. Examples include - functions, loops, conditionals. For loop (let i = 0; i < length; i++) is part of the following block.
What does block scope mean?
It means that a variable is not attached to the global window object and is only referenced inside the current code block.
What happens inside the code block, stays inside the code block.
What is the scope of a variable declared with const or let?
IT IS BLOCK SCOPE. It depends where it is declared, either inside a code block making it block scoped or outside. Allows using the same variable name with the let keyword outside a code block and reusing it with a second let keyword inside a code block.
What is the difference between let and const?
The difference is that let can be reassigned but const cannot be reassigned.
Why is it possible to .push() a new value into a const variable that points to an Array?
.push is not reassignment of a new array, only changing/mutating the original array.
How should you decide on which type of declaration to use?
Start with const, till the linter/compiler gets mad. Const should be used if no reassignment is needed. Let should be used if the variable will change throughout the code file.
What is the syntax for writing a template literal?
Backticks with ${} to denote substitutions.
What is “string interpolation”?
Concatenating strings and string substitutions.
What is destructuring, conceptually?
Pulling individual values from objects and arrays and assigning them to a variable.
What is the syntax for Object destructuring?
const { property: variableName } = original object
don’t need variable name if using property name for the variable name.
What is the syntax for Array destructuring?
Using brackets with the variables in the position of the array you want, assigned to the array.
const [a, , b] = array
How can you tell the difference between destructuring and creating Object/Array literals?
The side of the equal sign which the curly braces or brackets come on.
What is the syntax for defining an arrow function?
params or () => single line implied return declaration.
params or () => { code }
When an arrow function’s body is left without curly braces, what changes in its functionality?
It implies a return statement of one expression only.
What is a CLI?
Command line interface - usually called the console or terminal
What is a GUI?
A graphical user interface, most common for users, VS code is a GUI for coders, that also contains a CLI.
Give at least one use case for each of the commands listed in this exercise.
man
cat
ls
pwd
echo
touch
mkdir
mv
rm
cp
history
man -open a manual of a cmd
cat - print contents of a file
ls - ls files and directories
pwd - prints the current or working directory
echo - logs a string
touch - move a file - change timestamp
mkdir - make a new directory
mv - rename files or move
rm - remove files
cp - copy files
history - prints cmd line history
What are the three virtues of a great programmer?
hubris, impatience, laziness
What are the 3 components of a fullstack Web architecture?
frontend(presentation), backend server(logic handling), database
What is Node.js?
Allows JavaScript to be run outside of a browser.
What can Node.js be used for?
to build servers and other automation in command line programs.
What is a REPL?
A Read-eval-print loop. The part that allows you to run JavaScript code, like our developer tools in our browser.
When was Node.js created?
- may 27
What backend languages have you heard of?
express, Node, PHP, RUBY, C++, Java, C#
What is a computer process?
executable task
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
290