mirror of
https://github.com/getify/You-Dont-Know-JS.git
synced 2026-02-01 15:27:27 +00:00
commit
a5b49a8ec0
@ -47,7 +47,7 @@ a = { b: "c" };
|
||||
typeof a; // "object"
|
||||
```
|
||||
|
||||
The return value from the `typeof` operator is always one of six (seven as of ES6!) string values. That is, `typeof "abc"` returns `"string"`, not `string`.
|
||||
The return value from the `typeof` operator is always one of six (seven as of ES6! - the "symbol" type) string values. That is, `typeof "abc"` returns `"string"`, not `string`.
|
||||
|
||||
Notice how in this snippet the `a` variable holds every different type of value, and that despite appearances, `typeof a` is not asking for the "type of `a`", but rather for the "type of the value currently in `a`." Only values have types in JavaScript; variables are just simple containers for those values.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user