js的几种数据类型
2016-08-29 14:16
232 查看
javascript的几种基本类型:
- null
- undefined
- Boolean
- string
- Number
- Object
我看到网上一篇文章说是typeof无法判断function,可是为什么我试验了一下是可以判断的呢?不懂,欢迎各位看到有什么问题可以留言哦
var b=function(){console.log(999);} typeof b "function" Object.prototype.toString.call(b) "[object Function]"
array:typeof无法判断array倒确实,用Obeject.prototype.toString.call()
var a=new Array(1,2,3); undefined a [1, 2, 3] typeof a "object" Object.prototype.toString(a); "[object Object]"
null:
typeof null "object" Object.prototype.toString.call(null) "[object Null]"
Date:
var a=new Date() undefined a Mon Aug 29 2016 14:11:45 GMT+0800 (CST) typeof a "object" Object.prototype.toString.call(a) "[object Date]"
HTMLCollection:
var a=document.getElementsByTagName('div'); undefined Object.prototype.toString.call(a) "[object HTMLCollection]"
相关文章推荐
- 判断js中的数据类型的几种方法
- JS中检测数据类型的几种方式及优缺点小结
- js 判断各种数据类型 typeof 几种类型值
- JS中检测数据类型的几种方式及优缺点
- 粗体判断js中的数据类型有一下几种方法
- 判断js中的数据类型的几种方法
- js 判断数据类型的几种方法
- Js中数据类型判断的几种方法
- 几种常见的js数据类型转变
- 判断js中的数据类型的几种方法
- JS中检测数据类型的几种方式及优缺点小结
- JS开发中基本数据类型具体有哪几种
- JS中判断数据类型的几种方法
- js 判断数据类型的几种方法
- js中判断数据类型对的几种方法
- js判断数据类型的几种方法
- 转:判断js中的数据类型的几种方法
- JS/jQuery判断数据类型的几种方式
- 判断js中的数据类型的几种方法
- 判断js中的数据类型的几种方法