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

Promise.protoype.then() method

The then method handles both fulfillment and rejection values of the promise

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

promise.prototype.catch or promise.prototype.then methods can handle rejection of a promise

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

What is “syntactic sugar”?

A

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

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

What is the typeof an ES6 class?

A

ES6 are syntactic sugar for the constructor 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 + name of class + { + constructor +prototype methods + }

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

What is “refactoring”?

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

How are ES Modules different from CommonJS modules?

A

Syntax is more compact than CommonJS
Structure can be statically analyzed (for static checking, optimization, etc.)
Support for cyclic dependencies is better than CommonJS’s

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

What kind of modules can Webpack support?

A

ES modules, CommonJS modules, and AMD modules

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

What does fetch( ) return?

A

fetch returns a promise object which eventually becomes fulfilled

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

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

A

default request method is GET

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

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

A

fetch( path, { method: ‘GET’ })

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