ES6 Promises, Classes, and Modules 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

You call the then method of the promise object with a callback function

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

You call the catch method of the promise object with a callback function

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

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 Person {
	constructor(name) {
		this.name = name;
	}
	function() {
		function code
	}
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is “refactoring”?

A

Refactoring is re-writing code for readability and useability with abstraction while not changing the behavior

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

How are ES6 Modules different from CommonJS modules?

A

ES6 Modules are pre-parsed in order to resolve further imports before code is executed.

CommonJS modules load dependencies on demand while executing the code.

const varName = require(‘./file-path’); → 
import class/functionName from ‘./file-path’;
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

ES6, CommonJS, and AMD Modules

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