ES6 Flashcards

1
Q

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

A

a function code block. Something that is inside of curly brace

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

What does block scope mean?

A

means where the code can look

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 or function level

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

const is setting a variable that never changes and let allows you to change the variable.

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

because you’re adding a value not changing the original value.

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

How should you decide on which type of declaration to use?

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

back ticks are a major part of template literals.

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

What is “string interpolation”?

A

The JavaScript engine automatically replace these variables and expressions with their values.

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

What is destructuring, conceptually?

A

it’s taking specific properties and assigning them to a specific variable.

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{ variable , variable, variable } = 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 [variable, variable, variable] = object name.

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 we are creating the variable is on the right side. if it is on the right side we are evaluating the variable/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

variable declaration = (parameters(optional)) => { statements }

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
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
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 succesfully.
rejected: meaning that the operation failed.

17
Q

How do you handle the fulfillment of a Promise?

A

.then

18
Q

How do you handle the rejection of a Promise?

A

.catch

18
Q

What is “syntactic sugar”?

A
19
Q

What is the typeof an ES6 class?

A
20
Q

Describe ES6 class syntax.

A