Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because both of these are true:

    John.constructor === Function

    John !== Function
John is (approximately) a reference to a desugaring of its `constructor` “method” (which is the term I see used on MDN, I would have expected something more akin to “constructor declaration”; not 100% sure what the spec terminology is and don’t have time to chase it down atm) + its instance members assigned to the desugared function’s prototype. It’s more complicated than that for… reasons.

But the gist is that John.constructor references something other than the constructor defined in the class body, so calling that reference doesn’t call the thing it doesn’t reference at all.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: