ES6中的基本数据类型

时间:2018-03-30 13:59:32   收藏:0   阅读:187

Number,String, Null, Undefined, Symbol, Boolean

用typeof可以检测出变量的基本数据类型,但是有个特例,就是null的typeof返回的是object,这个是javascript的历史Bug

ES6新增数据类型Symbol: 表示独一无二的值

typeof Symbol() // ‘symbol‘

typeof Number() // ‘number‘

typeof Sring() // ‘string‘

typeof Function() // ‘function‘

typeof Objecr() // ‘object‘

typeof Boolean() // ‘boolean‘

typeof null() // ‘object‘

typeof undefined() // ‘undefined‘

原文:https://www.cnblogs.com/buerBlog/p/8675688.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!