0

I have noticed that if you write a program like this:

console.log(document);

It shows [object HTMLDocument]. Then, if you do this:

console.log(HTMLDocument);

it shows this:

function HTMLDocument() {
   [native code]
}

So, I am wondering what the HTMLDocument function is, and what its code is. Thanks!

JavaCakes
  • 361
  • 1
  • 3
  • 9

1 Answers1

1

This is the constructor of the HTMLDocument object.

Documentation:

The HTMLDocument interface, which may be accessed through the Window.HTMLDocument property, extends the Window.HTMLDocument property to include methods and properties that are specific to HTML documents.

Native code is a core functionality offered by the browser rather than a code written in Javascript.

Charlie
  • 22,886
  • 11
  • 59
  • 90