Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8808619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:40:11+00:00 2026-06-14T02:40:11+00:00

this is very confused me, and here is my simple html file: <html> <head>

  • 0

this is very confused me, and here is my simple html file:

<html>
    <head>
    </head>
    <body>
        <div id="misc">Test</div>
    </body>
</html>

in Firebug console: I have this script:

var c = document.documentElement.childNodes[2].childNodes[3];
alert(c.id); //Return misc
alert(c.constructor); // Return [object HTMLDivElement]

As far as I know, a constructor of a function is a function (which is also a object but I’m not talking about that Function Object here). Now c’s constructor is a object, and if I ask c’constructor constructor (which is c.constructor.constructor), It’ll now return a “real” function, like this:

function Object() {
    [native code]
} 

I don’t know why c.constructor is an object ( [object HTMLDivElement] ), it should be a function as expected.
Could you help me understand this one?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:40:12+00:00Added an answer on June 14, 2026 at 2:40 am

    The short answer is: c does not have a regular constructor.

    The longer answer: native objects like DOM elements, Function objects, the global object (usually window in browsers), the innerHTML function, etc. don’t have regular constructors. This is because they are usually not implemented in JavaScript but at a lower level (in whatever language the browser or interpreter was written in).

    The JavaScript language specification allows this – native built-in objects do not have to be normal javascript objects. The real reason is historical — the specs were written by basically reverse engineering Netscape Navigator and having all the contributors agree on what was written. Since then everyone just stuck to it for backwards compatibility. The practical reason usually given these days is performance: if browsers are allowed to do this then they can be faster since native objects need not carry the heavy baggage of normal JavaScript objects.


    In your specific case, DOM elements don’t have regular constructors. There are 2 ways you can “construct” DOM objects:

    1. document.createElement(). This is the official DOM method for creating <div>s, <span>s etc. In most browsers this method is not a normal constructor since DOM elements don’t normally inherit form its prototype.

    2. innerHTML(). This is a thin interface to access the browser’s HTML compiler. It’s the same compiler that the browser uses to parse regular web pages. Again, this is in no way a regular constructor since it doesn’t even return the object(s) it creates.

    Since DOM elements don’t have normal constructors, browsers may return anything for their constructor property including nothing at all. What you are seeing in your case is mostly left over implementation detail that have leaked through to the javascript engine. It’s not something you’re supposed to access or use. Much less depend on to develop applications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be something very simple but I'm totally confused. I have a JScrollPane
I'm very confused and am hoping someone might have had this problem and be
I am very confused. I have this lambda expression: tvPatientPrecriptionsEntities.Sort((p1, p2) => p1.MedicationStartDate .Value
This is a very simple question for compiler guys, but I always get confused
This is probably a very simple question but I'm a little confused how this
I've been confused by this problem for a very long time. I start the
This very simple code: #include <iostream> using namespace std; void exec(char* option) { cout
I'm very VERY new at this whole web thing. And I'm just very confused
PROBLEM SOLVED: I was overlooking a very simple issue, and that is that this
This very simple example confuses me: public class X { public void XMethod(A a)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.