typeof(true);//boolean
typeof(undefined);//undefined
typeof(null);//object
typeof(NaN);//number
typeof(1);//number
typeof('1');//string
typeof(Function);//function
typeof(function);//报错
本文详细介绍了JavaScript中使用typeof操作符来检测各种数据类型的用法。包括基本数据类型如布尔值、数值、字符串以及特殊值null、undefined和NaN的检测方式,并展示了如何区分不同类型的对象。
typeof(true);//boolean
typeof(undefined);//undefined
typeof(null);//object
typeof(NaN);//number
typeof(1);//number
typeof('1');//string
typeof(Function);//function
typeof(function);//报错

被折叠的 条评论
为什么被折叠?