Change the primitive value of an object with valueOf
by Mohan[ Edit ] 2012-09-20 22:49:34
Change the primitive value of an object with valueOf
function foo() {
this.valueOf = function() {
return 'this is my value';
}
}
var bar = new foo();
Print( bar ); // prints: this is my value
Print( bar == 'this is my value' ) // prints: true
Print( bar === 'this is my value' ) // prints: false