InterviewSolution
| 1. |
What are spread operators and rest parameters? |
|
Answer» ES6 introduced the keyword class in JavaScript. But class in JavaScript is still different than those USED in Object ORIENTED Programming LANGUAGES like C++ and Java. The ES6 classes are nothing but synthetic sugar for constructor function and internally behaves exactly the same. Consider the below example of Constructor function. Here we have a constructor function named “Mammal”. It have two properties of legs and name. It ALSO have a function called walk(), which uses the legs and name property. We are creating an INSTANCE called person, which then is calling the walk function. The same can be written with ES6 classes with constructor, but it is exactly the same. |
|