function Example(name){
return this.name = name;
}
console.log([0,"0",[],{},null].map(i => typeof new Example(i).name));
我运行结果为:["number", "string", "undefined", "undefined", "object"]
为什么会有undefined的呐?
function Example(name){
return this.name = name;
}
console.log([0,"0",[],{},null].map(i => typeof new Example(i).name));
我运行结果为:["number", "string", "undefined", "undefined", "object"]
为什么会有undefined的呐?