执行constructor后的结果是一个对象,而执行typeof后的结果是一个字符串。看下表的对比:
变量 | typeof 变量 | 变量.constructor |
{a:"b"} | "object" | Object |
["a","b"] | "object" | Array |
function(){} | "function" | Function |
"a" | "string" | String |
66 | "number" | Number |
true | "boolean" | Boolean |
new User() | "object" | User |
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛