es6 Flashcards
What is a code block? What are some examples of a code block?
i code block is whatever inside {}, functions, if conditions and loops all have code blocks
What does block scope mean?
it means that its scope only to whatever is inside the curly braces
What is the scope of a variable declared with const or let?
its scope to only inside the code block
What is the difference between let and const?
let is changeable but const is not
Why is it possible to .push() a new value into a const variable that points to an Array?
because we are pushing elements to the array but we are not reassigning the array.
How should you decide on which type of declaration to use?
let is usually used on variables that will have their values changed or reassigned. const is used for objects or arrays or values that will stay consistent throughout the function
What is the syntax for writing a template literal?
the syntax is backticks ` `
What is “string interpolation”?
its embedding variables into a string and getting the results of it
What is destructuring, conceptually?
taking values from properties and assigning it to a different variables
What is the syntax for Object destructuring?
const {} = object
What is the syntax for Array destructuring?
const [] = array
How can you tell the difference between destructuring and creating Object/Array literals?
an object will have {} and an array will have []
What is the syntax for defining an arrow function?
() => {
}
When an arrow function’s body is left without curly braces, what changes in its functionality?
it will return
How is the value of this determined within an arrow function?
a normal function will create its own content for this but the arrow function will inherit it
What is a CLI?
command-line interface
What is a GUI?
graphical-user interface
man
man gives us the option to view what a command name is a synopsis of the command and a description of what the command does
cat
it concatenates files and prints it
ls
the ls command gives us a list of our files or list directory contents
pwd
it prints the name of the current or working directory
echo
it displays a line of text
touch
change file timestamp
mkdir
it makes directories
mv
it moves files or renames them