typeof在ES6之前typeof返回值有6种,且值都是字符串类型分别是:undefined,string,number,boolean,object,functionvar 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”
检查数据类型
February 25, 2019 · 1 min · jiezi