Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null is not a built-in object #16309

Closed
Josh-Cena opened this issue May 21, 2022 · 2 comments · Fixed by #17546
Closed

null is not a built-in object #16309

Josh-Cena opened this issue May 21, 2022 · 2 comments · Fixed by #17546
Labels
Content:JS JavaScript docs

Comments

@Josh-Cena
Copy link
Member

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

null is put under the "Built-in objects" category, which is incorrect, because null is a keyword, not a property.

What did you expect to see?

I expect it to be moved to "Expressions & Operators", where new.target, this, etc. live.

That would separate this from undefined, which is desirable because undefined acts more like a "built-in object".

Do you have any supporting links, references, or citations?

https://tc39.es/ecma262/#prod-ReservedWord

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@github-actions github-actions bot added Content:JS JavaScript docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. and removed Content:JS JavaScript docs labels May 21, 2022
@sideshowbarker sideshowbarker added Content:JS JavaScript docs and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels May 21, 2022
@OnkarRuikar
Copy link
Contributor

But it is an object:

console.log(typeof null); // returns 'object'

I think it belongs in this list: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#value_properties

@Josh-Cena
Copy link
Member Author

Josh-Cena commented May 22, 2022

typeof import.meta === "object", typeof this === "object" (usually), typeof new.target === "function", but they are all in the "Expressions & statements" section. I understand that null is a constant while all these are contextually defined, but x being a "global object" means Object.hasOwn(globalThis, "x") is true. This holds for undefined and NaN but not for null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants