typeof的運算數未定義,返回的就是 "undefined".
運算數爲數字 typeof(x) = "number"
字符串 typeof(x) = "string"
布爾值 typeof(x) = "boolean"
對象,數組和null typeof(x) = "object"
函數 typeof(x) = "function"
typeof 運算符返回一個用來表示表達式的數據類型的字符串。
可能的字符串有:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。
如:
alert(typeof (123));//typeof(123)返回"number"
alert(typeof ("123"));//typeof("123")返回"string"