ECMAScript Flashcards
(2 cards)
1
Q
What are the differences between arrow functions and function expressions?
A
Arrow functions:
1. Have shorter, concise syntax
2. Do not have their own this, but is rather inherited
3. Do not have their own arguments object.
4. Cannot be used as constructors.
5. Are not suitable for defining object methods because they don’t bind this to the object.
6. Are not hoisted – You cannot call them before their definition.
2
Q
Are there any language structures that implement strict mode by default?
A
- ES6 Modules (import / export)
- Classes
- If a function is inside a module or class, it inherits strict mode.