1.

If A is the superclass and B is the subclass, then subclass inheriting the superclass can be represented as _________(a) B=inherit(A);(b) B=A.inherit();(c) B.prototype=inherit(A);(d) B.prototype=inherit(A.prototype);I got this question during an online interview.My doubt stems from Classes in JavaScript topic in division Classes and Modules in JavaScript of JavaScript

Answer»

The correct ANSWER is (c) B.PROTOTYPE=INHERIT(A);

The explanation: inherit() function is a predefined function in javascript which is used to inherit properties of another class. The subclass B inherits the prototype of the class A.



Discussion

No Comment Found

Related InterviewSolutions