Senior Flashcards
What is a code block? What are some examples of a code block?
A code block refers to code within curly brackets. i.e. for, if, function
What does block scope mean?
block scope means that the variable defined within a block will not be accessible from outside the block.
What is the scope of a variable declared with const or let?
block scope
What is the difference between let and const?
You can update let but you can’t update const
Why is it possible to .push( ) a new value into a const variable that points to an Array?
This happens because the constant is storing a reference to the array.
How should you decide on which type of declaration to use?
Ask yourself if you’re going to need to update that variable later.
What is the syntax for writing a template literal?
Hello my name is ${variable}.
What is “string interpolation”
the ability to substitute part of the string for the values of variables or expressions
What is destructuring, conceptually?
extracting data from arrays or objects
What is the syntax for Object destructuring?
let { property1: variable1, property2: variable2 } = object
What is the syntax for Array destructuring?
let [ x, y, z ] = array
How can you tell the difference between destructuring and creating Object / Array literals?
brackets on the left side
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?
implicit returns
How is the value of this determined within an arrow function?
value of this is determined during the definition time whereas in a regular function, this is defined in call time
What is a CLI?
Command Line Interface
- processes commands to a computer in the form of lines of text
What is a GUI?
Graphical User Interface
- a form of user interface that allows users to interact with electronic devices through graphical icons
What is Node.js?
Node.js is a program that allows JavaScript to be run outside of a web browser. It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What can Node.js be used for?
back ends for Web applications, command-line programs, any kind of automation that developers wish to perform
What is a REPL?
Read-eval-print loop
- a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user.
When was Node.js created?
2009
What back end languages have you heard of?
JavaScript, PHP, Ruby, Python, Java, Go, Node JS
What is a computer process?
a running instance of a program
Why should a full stack Web developer know that computer processes exist?
back end stuff like client side, api, and databases
What is the process object in a Node.js program?
a global object that provides information about the current working process
How do you access the process object in a Node.js program
just type process
What is the data type of process.argv in Node.js?
array of strings
What is a JavaScript module?
A single JavaScript file
What values are passed into a Node.js module’s local scope?
exports, require, module, __filename, __dirname
Give two examples of truly global variables in a Node.js program
console, process
What is the purpose of module.exports in a Node.js module?
It’s purpose is so that the function/object/array can be used in a different module (js file)
How do you import functionality into a Node.js module from another Node.js module?
require function
What is the JavaScript Event Loop?
The Event Loop is what allows us to asynchronously call functions.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
something is blocking when something is currently processing in the call stack, something that is non blocking is running but not part of the call stack like webAPIs
What is a directory?
a file system which contains references to other computer files/directories
What is a relative file path?
refers to a location that is relative to a current directory
What is an absolute file path?
always contains the root element and the complete directory list required to locate the file
What module does Node.js include for manipulating the file system?
fs module
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile( )
Are file operations using the fs module synchronous or asynchronous
asynchronous
What is NPM?
Node Package Manager
It’s a way to reuse code from other developers and also a way to share your code with them
What is a package?
The reusable code
How can you create a package.json with npm?
npm init
What is a dependency and how do you add one to a package?
When you install an npm package using npm install, you are installing it as a dependency.
npm install
What happens when you add a dependency to a package with npm?
npm will download dependencies that are listed in package.json
How do you add express to your package dependencies?
npm install express
What Express application method starts the server and binds it to a network PORT?
listen
How do you mount a middleware with an Express application?
app.use
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request, response, and the next middleware function in the application’s request-response cycle
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
What does the express.json( ) middleware do and when would you need it?
- it parses incoming requests with JSON payloads
- when we need to parse incoming data
What is the significance of an HTTP request’s method?
semantics, describes what we are trying to do
- express our intent
What is PostgreSQL and what are some alternative relational databases?
A relational database
- SQLite
- MySQL