ES6 Flashcards

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
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

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.

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

What module does Node.js include for manipulating the file system

A

the filesystem module

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

what is an absolute file path?

A

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

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

what is a relative file path?

A

A relative file path points to a file relative to the current directory

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

what is a directory?

A

a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories

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

What method is available in the Node.js fs module for writing data to a file?

A

writeFile method

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

Are file operations using the fs module synchronous or asynchronous?

A

both because there’s file and fileSync

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

what is a client?

A

service requesters who request data from a server.

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

what is a server?

A

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”

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

Which HTTP method does a browser issue to a web server when you visit a URL

A

the get method?

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

What is on the first line of an HTTP request message?

A

http method, request, http version

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

What is on the first line of an HTTP response message?

A

http protocol version, status code, status text

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

What are HTTP headers?

A

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.

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

Is a body required for a valid HTTP message?

A

nope

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

What is NPM?

A

npm is the world’s largest software registry that consists of the website, the Command Line Interface (CLI), and the registry

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

What is a package?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

How can you create a package.json with npm?

A

npm init –yes

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

What is a dependency and how to you add one to a package?

A

they are packages required by your application during production. with npm install then the package name

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

What happens when you add a dependency to a package with npm?

A

it creates a node_modules directory within the root directory.

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

How do you add express to your package dependencies?

A

npm install express

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

What Express application method starts the server and binds it to a network PORT?

A

listen method

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

How do you mount a middleware with an Express application?

A

with the use method

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

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

request object and response object

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

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

application/json charset= utf8

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

What does the express.json() middleware do and when would you need it?

A

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.

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

What is the significance of an HTTP request’s method?

A

to indicate the desired action to be performed for a given resource

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

What is PostgreSQL and what are some alternative relational databases?

A

a powerful, open source object-relational database, mySQL, SQL server by microsoft, oracle by oracle corporation

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

What are some advantages of learning a relational database?

A

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”

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

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

54
Q

What is a database schema?

A

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
Q

What is a table?

A

a table is a list of rows having the same set of attributes

56
Q

What is a row?

A

its a single, implicitly structured data item in a table

57
Q

What is SQL and how is it different from languages like JavaScript?

A

SQL is a declarative programming language that can retrieve create and manipulate data in a relational database.

58
Q

How do you retrieve specific columns from a database table?

A

using the select statement followed by list

59
Q

How do you filter rows based on some specific criteria?

A

the where clause

60
Q

What are the benefits of formatting your SQL?

A

consistent style and readability

61
Q

How do you limit the number of rows returned in a result set?

A

with the limit clause

62
Q

How do you retrieve all columns from a database table?

A

with the asterisk

63
Q

How do you control the sort order of a result set?

A

order by is default ascending so if you want descending add desc to the end .

64
Q

How do you add a row to a SQL table?

A

with the insert into statements followed by the category and parentheses that hold the attributes.

65
Q

what is a tuple?

A

A list of values that are wrapped in the parentheses

66
Q

How do you add multiple rows to a SQL table at once?

A

you specify more than one tuple of values separated by commas.

67
Q

How do you get back the row being inserted into a table without a separate select statement?

A

with a returning asterisk

68
Q

how do you update rows in a database table?

A

With the update statement and name of the table

69
Q

Why is it important to include a where clause in your update statements?

A

So it only targets specific rows

70
Q

How do you delete rows from a database table?

A

with a delete from statement and the table, a where clause with the category an operator and the attribute

71
Q

How do you accidentally delete all rows from a table?

A

delete from “table”

72
Q

what is a foreign key

A

the attributes that connect two different tables

73
Q

How do you join two SQL tables?

A

with the join clause category using the foreign key

74
Q

How do you temporarily rename columns or tables in a SQL statement?

A

using as keyword

75
Q

What are some examples of aggregate functions?

A

count sum max min avg

76
Q

What is the purpose of a group by clause?

A

to separate rows into groups and perform aggregate functions on those groups of rows

77
Q

What is Array.prototype.filter useful for?

A

returning a new array with values that pass a test?

78
Q

What is Array.prototype.map useful for?

A

creates a new array populated with the results of calling a provided function on every element in the calling array

79
Q

What is Array.prototype.reduce useful for?

A

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
Q

What is “syntactic sugar”?

A

Its syntax that is designed to make reading or expressing code easier.

81
Q

What is the typeof an ES6 class?

A

function

82
Q

Describe ES6 class syntax.

A

class keyword, function name curly braces constructor function parentheses, parameters curly braces this. parameter = parameter closing curly brace

83
Q

What is “refactoring”?

A

the process of restructuring existing computer code without changing its external behavior

84
Q

what is a webpack?

A

a static module bundler for modern JavaScript applications

85
Q

How do you add a devDependency to a package?

A

–save-dev command input

86
Q

What is an NPM script?

A

a way to run commands without manually typing it out?

87
Q

How do you execute Webpack with npm run?

A

npm run build

88
Q

How are ES Modules different from CommonJS modules?

A

es modules don’t have require function, or use the module object. they use the import/export keywords.

89
Q

What kind of modules can Webpack support?

A

ECMAScript modules
CommonJS modules
AMD modules

90
Q

What is React?

A

React is a declarative, efficient, and flexible JavaScript library for building user interfaces.

91
Q

What is a React element?

A

A react element is a plain object describing a component instance or DOM node and its desired properties

92
Q

How do you mount a React element to the DOM?

A

with the ReactDOM.render() method

93
Q

What is Babel?

A

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
Q

What is a Plug-in?

A

a software component that adds a specific feature to an existing computer program.

95
Q

What is a Webpack loader?

A

transformations that are applied to the source code of a module.

96
Q

How can you make Babel and Webpack work together?

A

with the babel loaders

97
Q

What is JSX?

A

it is a syntax extension to JavaScript

98
Q

Why must the React object be imported when authoring JSX in a module?

A

so they are in the same scope?

99
Q

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

with babel-loader

100
Q

What is a React component?

A

components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.

101
Q

How do you define a function component in React?

A

a single “props” (which stands for properties) object argument with data and returns a React element

102
Q

How do you mount a component to the DOM?

A

ReactDOM.render method with the element and the location it is going to be in?

103
Q

What are props in React?

A

properties

104
Q

How do you pass props to a component?

A

When React sees an element representing a user-defined component, it passes JSX attributes and children to this component as a single object

105
Q

How do you write JavaScript expressions in JSX?

A

within curly braces.

106
Q

how do you create “class” components in react?

A

with the render method

107
Q

how do you access props in a class component

A

use this keyword

108
Q

What is the purpose of state in React?

A

State is an object that determines how that component renders and behaves

109
Q

How to you pass an event handler to a React element?

A

via a prop

110
Q

What Array method is commonly used to create a list of React elements?

A

map method

111
Q

What is the best value to use as a “key” prop when rendering lists?

A

id

112
Q

What are controlled components?

A

An input form element whose value is controlled by React in this way is called a “controlled component”.

113
Q

What two props must you pass to an input for it to be “controlled”?

A

value and type

114
Q

What does express.static() return?

A

a middleware function

115
Q

What is the local __dirname variable in a Node.js module?

A

a path

116
Q

What does the join() method of Node’s path module do?

A

joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.

117
Q

what does fetch() return

A

A Promise that resolves to a Response object.

118
Q

What is the default request method used by fetch()?

A

get requests

119
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

inside the init argument

120
Q

When does React call a component’s componentDidMount method?

A

after the component is mounted

121
Q

Name three React.Component lifecycle methods.

A

componentDidMount, componentDidUpdate componentWillUnmount render

122
Q

How do you pass data to a child component?

A

through its props

123
Q

What must the return value of myFunction be if the following expression is possible

A

a function

124
Q
What does this code do?
const wrap = value => () => value;
A

wrap(value) will return function () => value

wrap(value)() will return value because the second parenthesis is calling the return value of wrap(value)

125
Q

In JavaScript, when is a function’s scope determined; when it is called or when it is defined?

A

definition time

126
Q

What allows JavaScript functions to “remember” values from their surroundings?

A

the closure.

127
Q

What does the acronym LIFO mean?

A

last in first out

128
Q

What methods are available on a Stack data structure?

A

pop peek, push

129
Q

What must you do to access the value at an arbitrary point in a stack (not just the “top”)?

A

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
Q

What does the acronym FIFO mean?

A

first in first out

131
Q

What methods are available on a Queue data structure?

A

peek enqueue dequeue

132
Q

What must you do to access the value at an arbitrary point in a queue (not just the “front”)?

A

dequeue to the value