ES6 Flashcards
(148 cards)
What is a code block? What are some examples of a code block?
es6-const-let
What does block scope mean?
es6-const-let
In JavaScript, blocks are denoted by curly braces {} , for example, the if else, for, do while, while, try catch
What is the scope of a variable declared with const or let?
es6-const-let
blocked-scope
What is the difference between let and const?
es6-const-let
lets can be reassigned, const cannot.
Why is it possible to .push() a new value into a const variable that points to an Array?
es6-const-let
You can update and reassign the value, but not what is assigned to the variable
How should you decide on which type of declaration to use?
es6-const-let
everything should be const until it cannot be, then use let. Use let mainly in loops.
What is the syntax for writing a template literal?
es6-template-literals
to create a template literal, wrap your text in backticks (`). for substitution ${}
What is “string interpolation”?
es6-template-literals
The substitutions allow you to embed variables and expressions in a string. The JavaScript engine will automatically replace these variables and expressions with their values.
What is destructuring, conceptually?
es6-destructuring
provides an alternative way to assign properties of an object to variables to store and use
What is the syntax for Object destructuring?
es6-destructuring
const { property1: variable1, property2: variable2 } = object;
What is the syntax for Array destructuring?
es6-destructuring
const [x, y, z] = getScores();
How can you tell the difference between destructuring and creating Object/Array literals?
es6-destructuring
what side the curly bracelets is on. left side is destructuring, right side is creating.
What is the syntax for defining an arrow function?
es6-arrow-functions
const variable name = (…args) => expression
When an arrow function’s body is left without curly braces, what changes in its functionality?
es6-arrow-functions
the arrow function has an implicit return
How is the value of this determined within an arrow function?
es6-arrow-functions
Arrow functions have a lexical this and its value within the arrow function is determined by the surrounding scope.
What is a CLI?
command-line-basics
command line interface
What is a GUI?
command-line-basics
Graphical user interface
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
command-line-basics
man - command information
cat - print content of text of file
ls - list the files
pwd - check what directory youre on
echo - line of text
touch - Modification time or mtime changes when a file’s contents change.
mkdir - creates a new, empty directory
mv- move and rename files
rm - remove files or directories
cp - copies folder and files
What are the three virtues of a great programmer?
command-line-basics
Laziness, Impatience, and Hubris.
What is Node.js?
node-intro
program that allows js to be run outside of browser
What can Node.js be used for?
node-intro
commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
node-intro
read, eval, print loop, allows to run language in background
When was Node.js created?
node-intro
may 2009
What back end languages have you heard of?
node-intro
Java, python, c++