Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

  1. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?

  2. A.

     HTMLElement.prototype(…)

    B.

     HTMLElement.prototype

    C.

     HTML.addmethods()

    D.

     HTML.elements(add)

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    It is implementation-dependent whether classes defined by the host environment (such as the web browser) can be augmented using Object.prototype. In many web browsers, for example, you can add methods to HTMLElement.prototype and those methods will be inherited by the objects that represent the HTML tags in the current document.


Be The First To Comment