語法:typeof(變量/關鍵字/對象) 圓括號可以省略;
返回一個字符串,表明操作數是什么類型的。
var myFun = new Function("5+2");
var shape="round";
var size=1;
var today=new Date();
typeof myFun // object
typeof shape // string
typeof size // number
typeof today // object
typeof dontExist // undefined
typeof true // boolean
typeof null // object
typeof 62 // number
typeof 'Hello world' // string
對于函數或者對象中的方法
typeof blur // function
typeof eval // function
typeof parseInt // function
typeof shape.split // function
對于預定義的內置類型
typeof Date // function
typeof Function // function
typeof Math // function
typeof Option // function
typeof String // function