Single Choice Easy

QHow do you add methods to HTMLElement such that the objects that stand in for the HTML tags in the current page may inherit them?

ID: #5010 Javascript Classes MCQ 249 views
Question Info
#5010Q ID
EasyDifficulty
Javascript Classes MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A HTMLElement.prototype(
  • B HTMLElement.prototype
  • C HTML.addmethods()
  • D HTML.elements(add)
Correct Answer

Explanation

Whether or not classes defined by the host environment (such as web browsers) can be augmented using Object.prototype depends on the implementation. In some cases, it may be possible to add methods to the prototype of a class and have those methods be inherited by objects that represent instances of the class.
For example, in many web browsers, it is possible to add methods to HTMLElement.prototype and have those methods be inherited by the objects that represent HTML tags in the current document.

Share This Question

Challenge a friend or share with your study group.