var f = new function(){return "asktest.com"}
console.info(f)//返回值为[object]

var f = new function(){return new String("asktest.com")}
console.info(f)//返回值为"asktest.com"

只要 new 表达式之后的 constructor 返回(return)一个引用对象(数组,对象,函数等),都将覆盖
new创建的匿名对象,如果返回(return)一个原始类型(无 return 时其实为 return 原始类型
undefined),那么就返回 new 创建的匿名对象。

2011-09-22 16:04:21

0

最新答案:

此问题还没有人回答,刚快抢个沙发吧!
没有您想要的答案吗? 浏览其他问题 问你自己的问题

赞助