0%

typeof 特性

typeof 特性

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
typeof {} => 'object'
typeof [] => 'object'
typeof null => 'object'
typeof new RegExp() => 'object'
typeof new Date() => 'object'
typeof new String('test') => 'object'
typeof new Number(100) => 'object'

typeof 0 => 'number'
typeof Infinity => 'number';
typeof NaN => 'number';

typeof () => {} => 'function'
typeof class TEST {} => 'function'
typeof new Functiuon() => 'function'

typeof true => 'boolean'

typeof undefined => 'undefined'
typeof document.all => 'undefined'
typeof undeclaredVariable => 'undefined'

typeof 'test' => 'string'

typeof Symbol() => 'symbol'