ES6/Node.js/npm/express Flashcards
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
What backend languages have you heard of?
Ruby, PHP, Java
What is a computer process?
an instance of a computer program being executed by one or more threads
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
a lot (mine has 420 processes)
Why should a full stack Web developer know that computer processes exist?
so you know how your application interacts with the operating system (OS) and hardware
What is the process object in a Node.js program?
provides information about, and control over, the current Node.js process
How do you access the process object in a Node.js program?
process
What is the data type of process.argv in Node.js?
an array of strings
How do you access the command line arguments in a Node.js program?
process.argv[2]
What is a JavaScript module?
it is a single ‘.js’ file and node is made up of multiple modules
What are the advantages of modular programming?
since you are breaking a big solution/problems into a lot of smaller ones, it can be an advantage by being able to be more organized with your code as well as help you solve parts at a time
In JavaScript, how do you make a function in a module available to other modules?
by exporting
In JavaScript, how do you use a function from another module?
by importing