var a = {
valueOf : function () {
return 10;
},
toString: function () {
return 'this is tostring';
}
}
//print this object a
console.log(a)
//20
console.log(a+10);
//this is tostrig10
delete a.valueOf;
console.log(a+10);
来源:oschina
链接:https://my.oschina.net/u/2285087/blog/3184907