Created
May 15, 2013 20:59
-
-
Save netojoaobatista/5587331 to your computer and use it in GitHub Desktop.
JavaScript ToString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test(value) { | |
this.value = value; | |
} | |
Test.prototype.toString = function() { | |
return 'The value is ' + this.value; | |
}; | |
var t = new Test(10); | |
print(t); //The value is 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment