惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

Jay Zangwill

前端该如何选择图片的格式 移动端适配 扒一扒浏览器缓存机制 line-height和vertical-align采坑记 分享个人前端学习路线及面试经验 搜狗实习总结 vue-cli-multipage 记一次我看红宝书对继承加深的理解 四月北京面试之旅 常用的mongodb命令 几个让我印象深刻的面试题(二) 几个让我印象深刻的面试题(一) css盒模型与定位 angular学习笔记(3) angular学习笔记(2) angular学习笔记(1) 初尝vue sass基础 hexo+github快速搭建个人博客
javscript的数据类型
Jay Zangwill · 2016-11-07 · via Jay Zangwill

javscript数据类型

之前学到javascript的数据类型时遇到了一些困惑,因为之前和一些大神交流和自己百度+谷歌查到的还有在红宝书上看到的答案不一样,最近通过查阅了一些资料终于把自己的困惑解决了,现在来写一些笔记记录记录。

之前和一些大神交流了一下javascript的数据类型的问题,这些大神大多数都把js的数据类型分为:

  • number

  • string

  • undefined

  • function

  • boolean

  • object

当时我就把javascript的数据类型分为这几种了,但是后来我又在网上发现有其他的一种分类:

  • number

  • string

  • undefined

  • null

  • boolean

  • symbol (es6新增)

  • object

可以发现,这两种分类的分歧在functionnull上。

可以判断:前者是根据typeof返回的值来分数据类型的,根据我所查到的资料说根据typeof来定义数据类型是不正确的,因为它只是一个运算符,它的返回值不能作为数据类型的依据。

资料上面还说了typeof null返回的object是个历史性的错误,按理来说应该返回null

注意:在javascript中

console.log(null==undefined) //true
console.lof(null===undefined) //false

ECMASscript标准中也很详细地说了数据类型和它们的值,发现都是以第二种分类为准。

至于新加的符号类型可以戳这里