查看变量或者表达式,存储数据的数据类型

typeof(变量):执行结果是 字符串类型

数据类型,typeof()的执行结果

        console.log( typeof(true) );      // boolean
        console.log( typeof(100) );       // number
        console.log( typeof(100.1233) );  // number
        console.log( typeof(2e3) );       // number
        console.log( typeof(NaN) );       // number
        console.log( typeof('北京') );    // string
        console.log( typeof(undefined) ); // undefined
        console.log( typeof( function(){} ) )   // function

对象,数组,null,使用 typeof() 执行结果都是 object

本质上,存储时,都是以对象的形式存储的,typeof的执行结果都是 object
之后我们会讲  数据类型的 准确判断方式
对象,数组,null 就不再都是 object
        console.log( typeof( {name:'张三'} ) );  // object
        console.log( typeof([1,2,3,4,5]) );      // object
        console.log( typeof(null) );             // object

不管变量是什么类型 typeof( typeof(变量) ) 结果一定是 string

typeof( typeof() ) ---- string

不靠谱的 typeof() 语法

typeof 变量:不靠谱的语法形式

console.log( typeof int );
如果变量之后,有其他程序,其他内容,容易造成冲突推荐使用 typeof() 语法

一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。