Add the text "x = true; console.log(type of x) // boolean ``` From t… (#26111)
* Add the text "x = true; console.log(type of x) // boolean ``` From the last example above, The `typeof` operator returns a boolean that represents the current type of a variable; x which is of value `true`." * Revert extra sentence
This commit is contained in:
committed by
Manish Giri
parent
4606509d9c
commit
e1e1f1cabb
@ -25,6 +25,8 @@ x = 'string';
|
||||
console.log(typeof x) // string
|
||||
x = { key: 'value' };
|
||||
console.log(typeof x) // object
|
||||
x = true;
|
||||
console.log(type of x) // boolean
|
||||
```
|
||||
|
||||
This can be useful for checking the type of a variable in a function and continuing as appropriate.
|
||||
|
Reference in New Issue
Block a user