Modern JS - Crash Course Flashcards
What is ECMAScript?
It is the specification that javascript conforms to.
What is the name of the committee that maintains javascript?
Ecma TC39
technical committee 39
How often TC39 releases new versions?
Yearly
What is a block scope? Can they be nested?
It is curly braces {}, yes can be nested.
Can we change the content of a const variable of a non scalar variable (primitive)
Yes. You just can’t change the reference to the object!
What is the main difference of a regular js function and an arrow function?
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.
What is a dinamyc property of an object literal? How is it declared?
It means the property will update another variable based on its content.
declared as const myValue = 'answer' const obj = { [myValue]: 42 } obj.answer //42
What is destructuring and how is it declared? Where is it used in React?
Destructuring means assigning references from a collection into separate variables.
declared as:
const {PI, E, SQRT2} = Math
Used in Hooks
What does the … do in js?
They make a copy of something
What is a template string?
It is a string that supports interpolation… e.g: hello ${user}
What is a promise?
Is an object that may deliver data at a later time in the program
How to consume a promise? What’s necessary after?
With “then”, where you need to supply a callback function.
What is a modern way to fetch data without using promise-chain?
By using async and await. Instead of nesting “then” you can await each call.
Is that possible to define css styles directly in the JSX? If so, how?
Yes, only use the styles={{margin: ‘20px’}}
What is the best applicability of JSX styles? Does it replace regular css files?
For conditional styles. For other use regular CSS file instead.