es6-classes Flashcards
What is “syntactic sugar”?
a term used in computer science to describe language constructs or notations that make a programming language easier to read or write, without changing its underlying meaning or behavior. It provides a more convenient or expressive way to perform operations that could be done in a more verbose or complex manner without it.
What is the typeof an ES6 class?
When used on an instance of an ES6 class, typeof will return the string “object”. When used on the class constructor function itself, it will return “function”.
Describe ES6 class syntax.
class MyClass {
constructor(arg1, arg2) {
this.property1 = arg1;
this.property2 = arg2;
}
method1() {
// implementation of method1
}
method2() {
// implementation of method2
}
}
What is “refactoring”?
“Refactoring” is the process of changing the structure of existing code to improve its readability, maintainability, or performance, without changing its functionality or behavior.