题目
var foo = new Foo(2); // foo.val = 2;
var boo = new Foo(3); // boo.val = 3;
foo + boo // => 结果必须是 5
解决方案模板
var Foo = function(value) {
this.val = value;
}
8 回复
var foo = function(value) { this.val = value; this.toString = function() { return this.val; } }; try it……