es6-classes Flashcards
1
Q
What is “syntactic sugar”?
A
syntax that makes code easier to read/express.
2
Q
What is the typeof an ES6 class?
A
object
3
Q
Describe ES6 class syntax.
A
- class keyword, followed by the class name (class definition)
- within the class body you have the
- definition of constructor() prototype method which assigns properties to the instance.
- its parameters are the names of the properties you want to define.
- its code block contains the initialization of the variables in the parameter to this.<propertyName></propertyName>
- followed by the rest of the definitions of the prototype methods that the object will carry.
4
Q
What is “refactoring”?
A
when you rewrite code (usually to make it look cleaner) but it’s functionality stays the same