版权声明:本文为作者原创,转载请注明出处,联系qq:32248827 https://blog.csdn.net/dataiyangu/article/details/84748594
typeof 可以用来检测给定变量的数据类型,可能的返回值:
- ‘undefined’
- ‘boolean’
- ‘string’
- ‘number’
- ‘object’
- ‘function’
var hahaha = 'hello world'; alert(typeof hahaha); // 'string' alert(typeof hahaha); // 'number'