JS OOPS 11 (QS)
JS OOPS 11 (QS)
[email protected]
Summary Sheet
[email protected]
Qs6. What is the difference between a constructor and a class in JavaScript?
Ans. A constructor is a function that creates an object, while a class is a blueprint for
creating objects. Classes define the framework whereas, constructor actually creates
the objects & initializes them.
(In JavaScript, classes are syntactic sugar over constructor functions.)