Modern JS - Crash Course Flashcards

1
Q

What is ECMAScript?

A

It is the specification that javascript conforms to.

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

What is the name of the committee that maintains javascript?

A

Ecma TC39

technical committee 39

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

How often TC39 releases new versions?

A

Yearly

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

What is a block scope? Can they be nested?

A

It is curly braces {}, yes can be nested.

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

Can we change the content of a const variable of a non scalar variable (primitive)

A

Yes. You just can’t change the reference to the object!

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

What is the main difference of a regular js function and an arrow function?

A

The scope of this of the first will be the caller’s environment and the second will be the defining environment. Therefore, the this keyword of an arrow function depends WHERE it is called.

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

What is a dinamyc property of an object literal? How is it declared?

A

It means the property will update another variable based on its content.

declared as
const myValue = 'answer'
const obj = {
  [myValue]: 42
}
obj.answer //42
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is destructuring and how is it declared? Where is it used in React?

A

Destructuring means assigning references from a collection into separate variables.

declared as:
const {PI, E, SQRT2} = Math

Used in Hooks

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

What does the … do in js?

A

They make a copy of something

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

What is a template string?

A

It is a string that supports interpolation… e.g: hello ${user}

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

What is a promise?

A

Is an object that may deliver data at a later time in the program

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

How to consume a promise? What’s necessary after?

A

With “then”, where you need to supply a callback function.

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

What is a modern way to fetch data without using promise-chain?

A

By using async and await. Instead of nesting “then” you can await each call.

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

Is that possible to define css styles directly in the JSX? If so, how?

A

Yes, only use the styles={{margin: ‘20px’}}

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

What is the best applicability of JSX styles? Does it replace regular css files?

A

For conditional styles. For other use regular CSS file instead.

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

What is the createRef method? What is a better way of doing it?

A

Is a method that references the value from a html component into a field. A better way of doing it is via value and onchange methods

17
Q

How to fetch data from api? What is a better option?

A

using fetch… better use axios

18
Q

What happens when you are rendering a list of components without specifying a key element?

A

React will give a warning and it is necessary to define an unique id to each card.