Node and The Senior Side Flashcards
What is a code block? What are some examples of a code block?
In JavaScript, blocks are denoted by curly braces {} , for example, the if else, for, do while, while, try catch and etc.
What does block scope mean?
The context in which values and expressions are “visible” or can be referenced. If a variable or other expression is not “in the current scope,” then it is unavailable for use.
What is the scope of a variable declared with const or let?
let and const are blocked-scope,
What is the difference between let and const?
const is immutable, use it if you don’t plan on reassigning that variable
Why is it possible to .push() a new value into a const variable that points to an Array?
The const keyword ensures that the variable it creates is read-only. However, it doesn’t mean that the actual value to which the const variable reference is immutable. However, you cannot reassign a different value to the person constant like this. you’re not changing memory address.
How should you decide on which type of declaration to use?
If you plan on re-using it or not.
What is the syntax for writing a template literal?
Using a backtick character, which will produce a new string
What is “string interpolation”?
String formatting: the ability to substitute part of the string for the values of variables or expressions.
What is destructuring, conceptually?
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
What is the syntax for Object destructuring?
declare a variable, have open curly braces, if necessary, give a property name, but you can be concise and reference the property.
What is the syntax for Array destructuring?
a variable with open brackets, and more variables within the brackets being = array variable name. order matters
How can you tell the difference between destructuring and creating Object/Array literals?
The Order of assignment
What is the syntax for defining an arrow function?
A variable with a name with an assignment operator with an arrow function with a parameter and then curly braces
When an arrow function’s body is left without curly braces, what changes in its functionality?
it expects one expression and automatically returns that expression. implicit means implied.
How is the value of this determined within an arrow function?
Arrow functions have a lexical this and its value within the arrow function is determined by the surrounding scope.
Where the function is defined… where as previous it was call time.
What is a CLI?
Command-line-interface, processes commands via lines of text
What is a GUI?
Graphic user interface, aimed at consumers of technology
Use Case for Man
Man displays the on-line manual pages, you can specify sections with it.
Use case for Cat
reads files sequentially, writing them to the standard output. in the exercise we could read a text file
Use case for ls
list directory contents
use case for pwd
writes absolute path name
use case for echo
write arguments to the standard output. we wrote a string, console log for console
use case for touch
Change file access and modify items, create file
use case for mkdir
make directories