js的几种数据类型
2016-08-29 14:16 改吧 阅读(395) 评论(0) 编辑 收藏 举报javascript的几种基本类型:
- null
- undefined
- Boolean
- string
- Number
- Object
我看到网上一篇文章说是typeof无法判断function,可是为什么我试验了一下是可以判断的呢?不懂,欢迎各位看到有什么问题可以留言哦
1 2 3 4 5 | var b=function(){console. log (999);} typeof b "function" Object.prototype.toString.call(b) "[object Function]" |
array:typeof无法判断array倒确实,用Obeject.prototype.toString.call()
1 2 3 4 5 6 7 8 | var a= new Array(1,2,3); undefined a [1, 2, 3] typeof a "object" Object.prototype.toString(a); "[object Object]" |
null:
1 2 3 4 | 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:
1 var a=document.getElementsByTagName('div'); 2 undefined 3 Object.prototype.toString.call(a) 4 "[object HTMLCollection]"
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· C# 深度学习:对抗生成网络(GAN)训练头像生成模型
· 手把手教你更优雅的享受 DeepSeek
· AI工具推荐:领先的开源 AI 代码助手——Continue
· 探秘Transformer系列之(2)---总体架构
· V-Control:一个基于 .NET MAUI 的开箱即用的UI组件库
· 乌龟冬眠箱湿度监控系统和AI辅助建议功能的实现