共计 329 个字符,预计需要花费 1 分钟才能阅读完成。
typeof 在 ES6 之前 typeof 返回值有 6 种,且值都是字符串类型分别是:undefined,string,number,boolean,object,function
var a;
typeof a; // “undefined”
a = “hello world”;
typeof a; // “string”
a=42;
typeof a; // “number”
a = true;
typeof a; // “boolean”
a = null;
typeof a; // “object”(注意)
a = undefined;
typeof a; // “undefined”
a={b:”c”};
typeof a; // “object”
function test(){
return 1;
}
typeof test // “function”
正文完
发表至: javascript
2019-02-25