js的基本数据类型及其typeof类型

 javascript只有6中基本数据类型,分别是:

null:空、无。表示不存在,当为对象的属性赋值为null,表示删除该属性
undefined:未定义。当声明变量却没有赋值时会显示该值。可以为变量赋值为undefined
number:数值。最原始的数据类型,表达式计算的载体
string:字符串。最抽象的数据类型,信息传播的载体
boolean:布尔值。最机械的数据类型,逻辑运算的载体

object:对象。面向对象的基础

其对应的typeof的值如下:

typeof(null)=object

typeof(object)=object

typeof([])=object

typeof(undefined)=undefined

typeof(number)=number

typeof(string)=string

typeof(boolean)=boolean

扫描二维码关注公众号,回复: 4665244 查看本文章

typeof(function(){})=function

猜你喜欢

转载自blog.csdn.net/weixin_39963132/article/details/80806148