JavaScript:null 的数据类型是什么? [英] JavaScript: What is the data type of null?

查看:44
本文介绍了JavaScript:null 的数据类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据说 null 在 JavaScript 中是主要类型.但是,当我在 null 上使用运算符 typeof 时,它返回 "Object".

It is said that null, in JavaScript, is a primary type. However, when I use the operator typeof on null, it returns "Object".

使typeof返回"Object"而不是"Primitive""null"的底层过程是什么?

推荐答案

null 的类型是对象.

Type of null is object.

您可以使用 typeof 关键字检查任何变量的类型.例如

you can check type of any variable with typeof keyword. for example

typeof null

查看下面的链接了解更多详情.

check the link below for more details.

这篇关于JavaScript:null 的数据类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆