ES6 Flashcards

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

How do you handle the fulfillment of a Promise?

A

Use then( ) method

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

How do you handle the rejection of a Promise?

A

Use then( ) method or catch( ) method

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

What is “syntactic sugar”?

A

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

It makes the language “sweeter” for human use: things can be expressed more clearly, more concisely, or in an alternative style that some may prefer.

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

What is thetypeofan ‘ES6 class’?

A

The class declaration is just syntactic sugar of the constructor function, therefore, the result of the ‘typeof’ operator of ES6 class is function.

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

Describe ES6 class syntax.

A

Class keyword followed by curly braces for the class declaration

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

What is “refactoring”?

A

Code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior; preserve functionality

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

What doesfetch()return?

A

fetch()takes one argument — the path to the resource you want to fetch — and returns a promise containing aResponseobject.

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

What is the default request method used byfetch()?

A

Get

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

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

A

By having a second parameter as an object containing the method request)

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