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

You call .then( ) on a Promise and then you pass in a callback that expects up to one parameter, the value it results to and then that will tell it what to do

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

What is “syntactic sugar”?

A

In computer science, syntactic sugar 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. Syntactic sugar is usually a shorthand for a common operation that could also be expressed in an alternate, more verbose, form: The programmer has a choice of whether to use the shorter form or the longer form, but will usually use the shorter form since it is shorter and easier to type and read.

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 Person {
constructor(name) {
this.name = name;
}
getName( ) {
return this.name;
}
}

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. Refactoring is intended to improve the design, structure, and/or implementation of the software (its non-functional attributes), while preserving its functionality. Potential advantages of refactoring may include improved code readability and reduced complexity; these can improve the source code’s maintainability and create a simpler, cleaner, or more expressive internal architecture or object model to improve extensibility. Another potential goal for refactoring is improved performance; software engineers face an ongoing challenge to write programs that perform faster or use less memory.

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

Different syntax

CommonJS modules load using require(), and variables and functions export from a CommonJS module with module.exports.

ES Modules load using import & export statements

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

Natively supports:
- ECMAScript modules
- CommonJS modules
- AMD modules
- Assets
- WebAssembly modules

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