JavaScript typeof运算符
2019-06-27 本文已影响0人
椰果粒
只能区分值类型,不能区分引用类型,能区分出函数来。
表达式 | 值 |
---|---|
typeof undefined | 'undefined' |
typeof 'aaa' | 'string' |
typeof 123 | 'number' |
typeof true | 'boolean' |
typeof {} | 'object' |
typeof [] | 'object' |
typeof null | 'object' |
typeof new RegExp() | 'object' |
typeof new Number() | 'object' |
typeof console.log | 'function' |