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

The typeof description is contrary to the specification. #2

Closed
demimurych opened this issue Jun 20, 2022 · 1 comment
Closed

The typeof description is contrary to the specification. #2

demimurych opened this issue Jun 20, 2022 · 1 comment

Comments

@demimurych
Copy link

Using the operator on a value produces a string that gives an indication of the type. Here are the possible values it can return:

Using the operator on a value produces a string that gives an indication of the type.

The typeof operator does not specify a type.
The unary typeof operator returns a string that is set according to various conditions.
https://tc39.es/ecma262/#sec-typeof-operator

Table - "Table 41: Operator Result Type" does not give all variants of conditions.

A typical example is an object with an internal value of [[IsHTMLDDA]]. As a result of performing a type operation on such an object, the result will always be undefined.

For this reason, it is incorrect to say that - typeof gives an indication of the type. This is misleading.

@demimurych demimurych changed the title chapter-1.md: typeof The description is contrary to the specification. The typeof description is contrary to the specification. Jun 20, 2022
@carltheperson
Copy link
Owner

I intentionally used the vague term "indication". Meaning I'm not saying there is a on-to-one mapping between language type of result of typeof.

I agree it doesn't give the language type in every case meaning you can't rely fully on it for that. Still, I think it's fair to loosely describe its purpose as indicating the type of a value (and then explain when that isn't the case).

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

No branches or pull requests

2 participants