ES6 Flashcards
What is the syntax for writing a template literal?
it uses backticks instead of quotes
What is “string interpolation”?
the ability to substitute part of the string for the values of variables or expressions
What is destructuring, conceptually?
unpacking values from objects or arrays and assigning it to variables
What is the syntax for Object destructuring?
variable declaration curly braces property keys equal sign and object being destructured
what is the syntax for array destructuring?
variable declaration square brackets elements and array being destructured
How can you tell the difference between destructuring and creating Object/Array literals?
destructuring has the array/object on the left of the equal sign. creating has it on the right side of the equal sign.
What is syntax for defining an arrow function?
parameter, arrow function keyword, statement/expression
When an arrow function’s body is left without curly braces, what changes in its functionality?
doesn’t need a return statement
How is the value of this determined within an arrow function?
at definition time
What is Node.js
its an asynchronous event-driven JavaScript runtime. aka you run js outside the web browser
What can Node.js be used for?
it can be used to build scalable network applications like web servers or cmd line applications.
What is REPL
it stands for read-eval-print loop that takes a single user input executes them and returns the result to the user.
When was Node.js created?
2009
What back end languages have you heard of?
Node, python, ruby, c, c++, java, c#, php, JavaScript, go, rust
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
around 300+cd processes
Why should a full stack Web developer know that computer processes exist?
because they are making multiple processes work together to form one application.
what is a computer process
the instance of a computer program being executed by one or many threads.
what is the process object in a Node.js program?
an object that provides information about, and control over, the current node.js process.
How do you access the process object in a Node.js program?
its always available to node.js applications without using require().
What is the data type of process.argv in Node.js?
an array of strings
what is a javascript module?
a js file
What values are passed into a Node.js module’s local scope?
__dirname __filename module require exports
Give two examples of truly global variables in a Node.js program.
process, console, global
what is the event.loop
The event loop is a process that keeps running and checks whether the call stack is empty or not. If the call stack is empty, it pushes the first item of the message queue into the call stack for execution.
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking makes the further execution of code not run until the first execution is finished while non-blocking doesn’t block execution. it makes it so we can’t do anything in the browser until the code finishes running.
What module does Node.js include for manipulating the file system
the filesystem module
what is an absolute file path?
An absolute file path is the full URL to a file, an absolute path refers to the same location in a file system relative to the root directory
what is a relative file path?
A relative file path points to a file relative to the current directory
what is a directory?
a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories
What method is available in the Node.js fs module for writing data to a file?
writeFile method
Are file operations using the fs module synchronous or asynchronous?
both because there’s file and fileSync
what is a client?
service requesters who request data from a server.
what is a server?
the providers of resources or service , a server is a piece of computer hardware or software (computer program) that provides functionality for other programs or devices, called “clients”
Which HTTP method does a browser issue to a web server when you visit a URL
the get method?
What is on the first line of an HTTP request message?
http method, request, http version
What is on the first line of an HTTP response message?
http protocol version, status code, status text
What are HTTP headers?
An HTTP header consists of its case-insensitive string followed by a colon (:), then by its value. let the client and the server pass additional information with an HTTP request or response. aka meta data about the request or response.
Is a body required for a valid HTTP message?
nope
What is NPM?
npm is the world’s largest software registry that consists of the website, the Command Line Interface (CLI), and the registry
What is a package?
A package is a file or directory that is described by a package.json file. A package must contain a package.json file in order to be published to the npm registry.
How can you create a package.json with npm?
npm init –yes
What is a dependency and how to you add one to a package?
they are packages required by your application during production. with npm install then the package name
What happens when you add a dependency to a package with npm?
it creates a node_modules directory within the root directory.
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 method
How do you mount a middleware with an Express application?
with the use method
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request object and response object
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json charset= utf8
What does the express.json() middleware do and when would you need it?
it parses incoming requests with JSON payloads and is based on body-parser, when your app needs to know how to parse JSON request bodies.
What is the significance of an HTTP request’s method?
to indicate the desired action to be performed for a given resource
What is PostgreSQL and what are some alternative relational databases?
a powerful, open source object-relational database, mySQL, SQL server by microsoft, oracle by oracle corporation
What are some advantages of learning a relational database?
Many problem domains can be modeled well using a relational database, they support good guarantees about data integrity. This means that developers can set up their database to reject “bad” data and not worry about data being “half written”