ES6/Node.js/npm/express Flashcards
(92 cards)
What is a code block? What are some examples of a code block?
A code block is sets of code that are enclosed in {} curly braces. An example would be a function code block.
What does block scope mean?
Variables that exist only when they are within a block?
What happens in the code block, it stays inside the code block
What is the scope of a variable declared with const or let?
blocked scope variable
What is the difference between let and const?
let variables can be reassigned while const variables cannot
Why is it possible to .push() a new value into a const variable that points to an Array?
Because we are not reassigning the array itself, we are adding new variables into the array
How should you decide on which type of declaration to use?
You should use let when you know you are going to reassign the variable. And typically use const when you know you are not going to change it.
What is the syntax for writing a template literal?
${variable_name}
What is “string interpolation”?
It is a feature that has the ability to sub parts of a string with values of variables or expressions
What is destructuring, conceptually?
breaking down arrays or objects and giving values and properties a variable
What is the syntax for Object destructuring?
const or let {object_properties} = object_name;
What is the syntax for array destructuring?
const or let [variable_names] = object_name;
How can you tell the difference between destructuring and creating Object/Array literals?
by seeing which side the equal sign shows up
What is the syntax for defining an arrow function?
let myFunction = (…args) => expression
When an arrow function’s body is left without curly braces, what changes in its functionality?
nothing, only use curly braces for block syntax
How is the value of this determined within an arrow function?
it captures the value of the enclosing context instead of creating its own
What is a CLI?
command line interface
What is a GUI?
graphic 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
man (manual) - man cat
cat (outputs contents) - cat example.txt
ls (list of files) - ls example/
pwd (presents working directory) - pwd
echo (display line of text) - echo ‘Hello, World!’
touch (change file timestamps and file creation) - touch create-file.txt
mkdir (make directories) - mkdir example
mv (move or rename files) - mv pokimans pokemon
rm (remove files) - rm example.txt
cp (copy files and directories) - cp example.txt example2.txt
What are the three virtues of a great programmer?
laziness, impatience, hubris
What are the 3 components of a fullstack Web architecture?
presentation(frontend), logic(backend), data tiers
What is Node.js?
designed to build scalable network applications as an asynchronous event-driven JavaScript runtime for servers
What can Node.js be used for?
server side of javascript, to get requests from the server
What is a REPL?
Read–eval–print loop takes single user inputs, executes them, and returns the result to the user
When was Node.js created?
May 27, 2009