ES6 Flashcards

1
Q

What is a code block? What are some examples of a code block?

A

code written inside the bracket {}
function bodys
loops
conditional

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

What does block scope mean?

A

something only existing inside the block

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

What is the scope of a variable declared with const or let?

A

block scope

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

What is the difference between let and const?

A

let variable can be reassigned const cant be reassigned

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

Why is it possible to .push() a new value into a const variable that points to an Array?

A

the const variable, in this case, an array, itself is immutable; on the other hand, the array itself is mutable - meaning, you can add new things to the array; think reassignment

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

What is the syntax for writing a template literal?

A

` `

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

What is the syntax for writing a template literal?

A

${expression}

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

What is destructuring conceptually?

A

takes values from arrays, or properties from objects, into distinct variables.

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

What is the syntax for Object destructuring?

A

const or let {propertyname} = object

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

What is the syntax for Array destructuring?

A

const or let or var [variable name ] = array

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

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

A

if the array or object is on the left side then it destructuring

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

What is the syntax for defining an arrow function?

A
var keyword function  = arguements => expresion
let func = (arg1, arg2, ..., argN) => expression
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

you can only have 1 line of code no curly braces no return keyword and it has to be an expression

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

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

A

based on the code block where the method is called

this is determined by call time based on its parents cod block

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

What is a CLI?

A

command line interface

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

What is a GUI?

A

graphical line interface

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

man is the manual
cat is when you want to add more than 1 file together
ls list directory contents
pwd returns working directory name
echo write arguments to the standard output
touch changes file access and modification times
mkdir makes directories
mv moves files or renames
rm removes files
cp makes a copy of the files

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

What are the three virtues of a great programmer?

A

laziness, impatience, and hubris.

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

What is Node.js?

A

a program that allows JavaScript in to be run outside of a web browser

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

What can Node.js be used for?

A

To build back ends for Web applications, command-line programs or any automation for devs to use

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

What is a REPL?

A

It is a quick and easy way to test simple Node.js/JavaScript code

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

When was Node.js created?

A

May 27, 2009

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

What back end languages have you heard of?

A

C# Java JS C++ Go VBA PHP Ruby Python Rust Haskell Pascal Perl Lisp C Clojure Rust Objective-C Swift Kotlin Julia Haskell Pas

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

What is a computer process?

A

The instance of a computer program that is being executed by one or many threads

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

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

A

more than 100

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

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

A

they should know how processes are working together to make an application work

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

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

A

is a global 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
29
Q

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

A

just call it its global

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

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

A

array of strings

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

What is a JavaScript module?

A

a “module” is a single .js file

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

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

A

filename dirname module require and exports

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

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

A

process

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

What is the purpose of module.exports in a Node.js module?

A

the instruction that tells Node. js which bits of code (functions, objects, strings, etc.) to “export” from a given file so other files are allowed to access the exported code

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

How do you import functionality into a Node.js module from another Node.js module?

A

call the require and use the correct file path

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

What is the JavaScript Event Loop?

A

Cycles through the call stack and checks if theres anything in the task queue and pushes that to the task queue

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

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

A

blocking is execution must wait till other code is completed
none blocking doesnt block the code from being executed

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

What is a directory?

A

a collection of files typically created for organizational purposes

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

What is a relative file path?

A

refers to a location that is relative to a current directory

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

What is an absolute file path?

A

path always contains the root element and the complete directory list required to locate the file

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

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

A

fs module

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

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

A

writefile

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

Are file operations using the fs module synchronous or asynchronous?

A

fs module are both synchronous and asynchronus

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

What is NPM?

A

NPM is a software registry. Where developers can share and borrow reusable code. it can mean the website cli registry

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

What is a package?

A

A file or directory that is describes by a package.json

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

How can you create a package.json with npm?

A

inside the root directory run the command

npm init –yes

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

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

A

Packages required by your application in production.
You can add dependencies to a package.json file from the command line or by manually editing the package.json file npm install name of pacakge

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

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

A

npm add dependencies to to package.json theres a node module directory created as well

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

How do you add express to your package dependencies?

A

npm install express adds to package.json

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

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

A

listen()

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

What is a client?

A

Requests a service made available by a server

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

What is a server?

A

Provides the services that the client requests

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

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

A

GET

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

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

A

The HTTP method like (GET, POST, AND PUT)

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

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

A

The protocol version

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

What are HTTP headers?

A

Let the client and the server pass additional information with an HTTP request or response.

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

Is a body required for a valid HTTP message?

A

No

58
Q

How do you mount a middleware with an Express application?

A

use()

59
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

60
Q

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

A

application/json

61
Q

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

A

parses incoming json body from ,we will need it

62
Q

What is PostgreSQL and what are some alternative relational databases?

A

Free, open source Relational Database Management System (RDBMS).
Microsoft SQL. MySQL. Oracle Database IBM Db2 SAP HANA Amazon Relational Database Service (RDS) SQLite
MariaDB

63
Q

What are some advantages of learning a relational database?

A

Data Accuracy
Easy Access to Data
They are used everywhere

64
Q

What is one way to see if PostgreSQL is running?

A

sudo service postgresql status

65
Q

What is a database schema?

A

A collection of tables. It defines how the data in a relational database should be organized

66
Q

What is a table?

A

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

67
Q

What is a row?

A

set of related data

68
Q

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

A

SQL is the most common language for extracting and organizing data that is stored in a relational database. SQL is declarative programming where you can describe the results and imperative programming like JS youre on charge on have to write specific ways on how to get there

69
Q

How do you retrieve specific columns from a database table?

A

use select clause followed by the column you want

select “column”

70
Q

How do you filter rows based on some specific criteria?

A

use clause where followed what you want filtered and assign and operator of what you want it filtered by
where “column” = ‘false’;

71
Q

What are the benefits of formatting your SQL?

A

makes the code more easier to read and understand making it more efficient

72
Q

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

A

use limit keyword followed by number you want to limit

73
Q

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

A

use limit clause followed by number you want to limit

74
Q

How do you retrieve all columns from a database table?

A

use * on select clause

select *

75
Q

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

A

use desc or asc on clause order by

order by “column desc

76
Q

How do you add a row to a SQL table?

A

insert into clause
insert into “products” (“name”, “description”, “price”, “category”)
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’)

77
Q

What is a tuple?

A

group of values in the parenthesis

78
Q

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

A

use values keyword then comma to seperate

79
Q

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

A

before you end with semicolon use returning clause with an *

80
Q

How do you update rows in a database table?

A

update clause followed by the table name
set clause column name and assigning the new value
update “products”
set “price” = 100;

81
Q

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

A

to get specific rows you want to updated if not they will all be updated

82
Q

How do you delete rows from a database table?

A

delete from clause then the table

83
Q

How do you accidentally delete all rows from a table?

A

if you omit the where clause itll delete all rows
delete from “products”
where “productId” = 24

84
Q

What is a foreign key?

A

shared attributes in tables

85
Q

How do you join two SQL tables?

A

join “name of table” using (“column name”)

86
Q

What are some examples of aggregate functions?

A

MIN, MAX, AVG, SUM, and COUNT.

87
Q

What is the purpose of a group by clause?

A

used to group rows that have the same values

88
Q

What are the three states a Promise can be in?

A

pending: initial state, neither fulfilled nor rejected.
fulfilled: meaning that the operation was completed successfully.
rejected: meaning that the operation failed.

89
Q

How do you handle the fulfillment of a Promise?

A

.then(callback)

90
Q

How do you handle the rejection of a Promise?

A

.catch(callback)

91
Q

How do you handle the rejection of a Promise?

A

.catch(callback)

92
Q

What is Array.prototype.filter useful for?

A

to give you back elements in an array that you specify for

93
Q

What is Array.prototype.map useful for?

A

transform each element of an array and put the new transformation into a new array

94
Q

What is “syntactic sugar”?

A

Syntax within a programming language that is designed to make things easier to read or to express.

95
Q

What is the typeof an ES6 class?

A

function

96
Q

Describe ES6 class syntax.

A
class "name"{
constructor(a,b,c,d){
this.a =a
this.b = b
this.c = c
}
more methods 
}
97
Q

What is “refactoring”?

A

altering its internal structure without changing its external behavior.

98
Q

What is “refactoring”?

A

altering its internal structure without changing its external behavior.

99
Q

What is Webpack?

A

takes all modules in your main js and puts them all together and uses it

100
Q

How do you add a devDependency to a package?

A

npm install –save-dev ‘name of package’

101
Q

What is an NPM script?

A

allows you to define script commands using the scripts field in the package.json file.

102
Q

How do you execute Webpack with npm run?

A

check if command is in the script and run the name of the property

103
Q

How are ES Modules different from CommonJS modules?

A

es6 modules statically called, commonjs are dynamic,commonjs use module.exports property

104
Q

What kind of modules can Webpack support?

A

ECMAScript modules. CommonJS modules. AMD modules.

105
Q

What is React?

A

React is a JavaScript library for creating user interfaces.

106
Q

What is a React element?

A

an object what gets returned from components

107
Q

How do you mount a React element to the DOM?

A

ReactDOM.render(element, container[, callback])

108
Q

What is Babel?

A

Convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments

109
Q

What is a Plug-in?

A

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

110
Q

What is a Webpack loader?

A

transformation that is applied to the the source code of a module

111
Q

How can you make Babel and Webpack work together?

A

npm install –save-dev babel-loader

112
Q

What is JSX?

A

a syntax extension to JavaScript

113
Q

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

A

you need to import react so that the complied output could call the create element

114
Q

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

A

webpack will take plain js and bundle it together babel plugin

115
Q

What is a React component?

A

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation

116
Q

How do you define a function component in React?

A

function and capitalize name with parameters if there is and it has to return a react element

117
Q

How do you mount a component to the DOM?

A

render dom method and mount elements

118
Q

What are props in React?

A

its object of arguments passed into React components

119
Q

How do you write JavaScript expressions in JSX?

A

you have to surround the JavaScript code in { } brackets

120
Q

How do you pass props to a component?

A

react element attribute and assign a string or a js expression

121
Q

How do you create “class” component in React?

A
class key word name of funciton extends component property  render function 
ex.(class CustomButton extends React.Component {
  render() {
    return {this.props.text};
  }
122
Q

How do you access props in a class component?

A

with “this” object

123
Q

What is the purpose of state in React?

A

to represent info of the component current state

124
Q

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

A

the property onclick{function}

125
Q

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

A

map()

126
Q

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

A

To use a string that uniquely identifies a list item among its siblings

127
Q

What are controlled components?

A

elements whose value is controlled by React

128
Q

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

A

value and onchange

129
Q

What does express.static() return?

A

middleware function that returns an object

130
Q

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

A

the file path

131
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

132
Q

What does fetch() return?

A

a promise for a response

133
Q

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

A

get request

134
Q

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

A

init object 2nd parameter
fetch(‘/some-url,
method: “trace”)
call what method and what put what ever method you want

135
Q

When does React call a component’s componentDidMount method?

A

after the component gets mounted on the DOM

136
Q

Name three React.Component lifecycle methods.

A

Mounting, Updating and Unmounting.

137
Q

How do you pass data to a child component?

A

through the props

138
Q

What must the return value of myFunction be if the following expression is possible?
myFunction()();

A

Return value has to be a function definition.

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

Returns a function that returns value.

140
Q

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

A

when its defined

141
Q

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

A

closure