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

object.then(value => {
console.log(value);
};

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

object.catch(error => {
console.log(error or error.message)
};

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

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
Opening curly brace for class declaration
Constructor and Method definitions
Closing curly brace for class declaration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is “refactoring”?

A

Restructuring existing code without changing its external behavior.

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

They syntax is more compact
Their structure can be statically analyzed (for static checking, optimization, etc.).
Their 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
ECMASCript modules
CommonJS modules
AMD modules
Assets
WebAssembly modules
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe importing a module.

A

Import keyword

opening curly brace { if not a default import

Comma separated names of imports

Closing curly brace } if not a default import

From keyword

Directory string in parenthesis.

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

Describe exporting a module.

A

Export keyword
If default add Default keyword. Only one per module

Either the variable name or the code block being exported.

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