ES6 Flashcards

(132 cards)

1
Q

What is the syntax for writing a template literal?

A

it uses backticks instead of quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is “string interpolation”?

A

the ability to substitute part of the string for the values of variables or expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is destructuring, conceptually?

A

unpacking values from objects or arrays and assigning it to variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the syntax for Object destructuring?

A

variable declaration curly braces property keys equal sign and object being destructured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the syntax for array destructuring?

A

variable declaration square brackets elements and array being destructured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you tell the difference between destructuring and creating Object/Array literals?

A

destructuring has the array/object on the left of the equal sign. creating has it on the right side of the equal sign.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is syntax for defining an arrow function?

A

parameter, arrow function keyword, statement/expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

doesn’t need a return statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is the value of this determined within an arrow function?

A

at definition time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Node.js

A

its an asynchronous event-driven JavaScript runtime. aka you run js outside the web browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What can Node.js be used for?

A

it can be used to build scalable network applications like web servers or cmd line applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is REPL

A

it stands for read-eval-print loop that takes a single user input executes them and returns the result to the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When was Node.js created?

A

2009

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What back end languages have you heard of?

A

Node, python, ruby, c, c++, java, c#, php, JavaScript, go, rust

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

around 300+cd processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why should a full stack Web developer know that computer processes exist?

A

because they are making multiple processes work together to form one application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

what is a computer process

A

the instance of a computer program being executed by one or many threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

what is the process object in a Node.js program?

A

an object that provides information about, and control over, the current node.js process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you access the process object in a Node.js program?

A

its always available to node.js applications without using require().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the data type of process.argv in Node.js?

A

an array of strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what is a javascript module?

A

a js file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What values are passed into a Node.js module’s local scope?

A

__dirname __filename module require exports

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Give two examples of truly global variables in a Node.js program.

A

process, console, global

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

what is the event.loop

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
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.
26
What module does Node.js include for manipulating the file system
the filesystem module
27
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
28
what is a relative file path?
A relative file path points to a file relative to the current directory
29
what is a directory?
a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories
30
What method is available in the Node.js fs module for writing data to a file?
writeFile method
31
Are file operations using the fs module synchronous or asynchronous?
both because there's file and fileSync
32
what is a client?
service requesters who request data from a server.
33
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"
34
Which HTTP method does a browser issue to a web server when you visit a URL
the get method?
35
What is on the first line of an HTTP request message?
http method, request, http version
36
What is on the first line of an HTTP response message?
http protocol version, status code, status text
37
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.
38
Is a body required for a valid HTTP message?
nope
39
What is NPM?
npm is the world's largest software registry that consists of the website, the Command Line Interface (CLI), and the registry
40
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.
41
How can you create a package.json with npm?
npm init --yes
42
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
43
What happens when you add a dependency to a package with npm?
it creates a node_modules directory within the root directory.
44
How do you add express to your package dependencies?
npm install express
45
What Express application method starts the server and binds it to a network PORT?
listen method
46
How do you mount a middleware with an Express application?
with the use method
47
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
request object and response object
48
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json charset= utf8
49
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.
50
What is the significance of an HTTP request's method?
to indicate the desired action to be performed for a given resource
51
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
52
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"
53
What is one way to see if PostgreSQL is running?
sudo service postgresql status
54
What is a database schema?
A schema defines how the data in a relational database should be organized and is also a collection of tables. its a plan for your data.
55
What is a table?
a table is a list of rows having the same set of attributes
56
What is a row?
its a single, implicitly structured data item in a table
57
What is SQL and how is it different from languages like JavaScript?
SQL is a declarative programming language that can retrieve create and manipulate data in a relational database.
58
How do you retrieve specific columns from a database table?
using the select statement followed by list
59
How do you filter rows based on some specific criteria?
the where clause
60
What are the benefits of formatting your SQL?
consistent style and readability
61
How do you limit the number of rows returned in a result set?
with the limit clause
62
How do you retrieve all columns from a database table?
with the asterisk
63
How do you control the sort order of a result set?
order by is default ascending so if you want descending add desc to the end .
64
How do you add a row to a SQL table?
with the insert into statements followed by the category and parentheses that hold the attributes.
65
what is a tuple?
A list of values that are wrapped in the parentheses
66
How do you add multiple rows to a SQL table at once?
you specify more than one tuple of values separated by commas.
67
How do you get back the row being inserted into a table without a separate select statement?
with a returning asterisk
68
how do you update rows in a database table?
With the update statement and name of the table
69
Why is it important to include a where clause in your update statements?
So it only targets specific rows
70
How do you delete rows from a database table?
with a delete from statement and the table, a where clause with the category an operator and the attribute
71
How do you accidentally delete all rows from a table?
delete from "table"
72
what is a foreign key
the attributes that connect two different tables
73
How do you join two SQL tables?
with the join clause category using the foreign key
74
How do you temporarily rename columns or tables in a SQL statement?
using as keyword
75
What are some examples of aggregate functions?
count sum max min avg
76
What is the purpose of a group by clause?
to separate rows into groups and perform aggregate functions on those groups of rows
77
What is Array.prototype.filter useful for?
returning a new array with values that pass a test?
78
What is Array.prototype.map useful for?
creates a new array populated with the results of calling a provided function on every element in the calling array
79
What is Array.prototype.reduce useful for?
The benefit of using reduce comes into play when you want to map and filter together and you have a lot of data to go over
80
What is "syntactic sugar"?
Its syntax that is designed to make reading or expressing code easier.
81
What is the typeof an ES6 class?
function
82
Describe ES6 class syntax.
class keyword, function name curly braces constructor function parentheses, parameters curly braces this. parameter = parameter closing curly brace
83
What is "refactoring"?
the process of restructuring existing computer code without changing its external behavior
84
what is a webpack?
a static module bundler for modern JavaScript applications
85
How do you add a devDependency to a package?
--save-dev command input
86
What is an NPM script?
a way to run commands without manually typing it out?
87
How do you execute Webpack with npm run?
npm run build
88
How are ES Modules different from CommonJS modules?
es modules don't have require function, or use the module object. they use the import/export keywords.
89
What kind of modules can Webpack support?
ECMAScript modules CommonJS modules AMD modules
90
What is React?
React is a declarative, efficient, and flexible JavaScript library for building user interfaces.
91
What is a React element?
A react element is a plain object describing a component instance or DOM node and its desired properties
92
How do you mount a React element to the DOM?
with the ReactDOM.render() method
93
What is Babel?
a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments
94
What is a Plug-in?
a software component that adds a specific feature to an existing computer program.
95
What is a Webpack loader?
transformations that are applied to the source code of a module.
96
How can you make Babel and Webpack work together?
with the babel loaders
97
What is JSX?
it is a syntax extension to JavaScript
98
Why must the React object be imported when authoring JSX in a module?
so they are in the same scope?
99
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
with babel-loader
100
What is a React component?
components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.
101
How do you define a function component in React?
a single “props” (which stands for properties) object argument with data and returns a React element
102
How do you mount a component to the DOM?
ReactDOM.render method with the element and the location it is going to be in?
103
What are props in React?
properties
104
How do you pass props to a component?
When React sees an element representing a user-defined component, it passes JSX attributes and children to this component as a single object
105
How do you write JavaScript expressions in JSX?
within curly braces.
106
how do you create "class" components in react?
with the render method
107
how do you access props in a class component
use this keyword
108
What is the purpose of state in React?
State is an object that determines how that component renders and behaves
109
How to you pass an event handler to a React element?
via a prop
110
What Array method is commonly used to create a list of React elements?
map method
111
What is the best value to use as a "key" prop when rendering lists?
id
112
What are controlled components?
An input form element whose value is controlled by React in this way is called a “controlled component”.
113
What two props must you pass to an input for it to be "controlled"?
value and type
114
What does express.static() return?
a middleware function
115
What is the local __dirname variable in a Node.js module?
a path
116
What does the join() method of Node's path module do?
joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.
117
what does fetch() return
A Promise that resolves to a Response object.
118
What is the default request method used by fetch()?
get requests
119
How do you specify the request method (GET, POST, etc.) when calling fetch?
inside the init argument
120
When does React call a component's componentDidMount method?
after the component is mounted
121
Name three React.Component lifecycle methods.
componentDidMount, componentDidUpdate componentWillUnmount render
122
How do you pass data to a child component?
through its props
123
What must the return value of myFunction be if the following expression is possible
a function
124
``` What does this code do? const wrap = value => () => value; ```
wrap(value) will return function () => value | wrap(value)() will return value because the second parenthesis is calling the return value of wrap(value)
125
In JavaScript, when is a function's scope determined; when it is called or when it is defined?
definition time
126
What allows JavaScript functions to "remember" values from their surroundings?
the closure.
127
What does the acronym LIFO mean?
last in first out
128
What methods are available on a Stack data structure?
pop peek, push
129
What must you do to access the value at an arbitrary point in a stack (not just the "top")?
assign the values that are being popped to a variable then peek at the value that needs to be accessed and then push the values that are assigned to a variable back into the stack
130
What does the acronym FIFO mean?
first in first out
131
What methods are available on a Queue data structure?
peek enqueue dequeue
132
What must you do to access the value at an arbitrary point in a queue (not just the "front")?
dequeue to the value