I want to overload the conversion of an object to a string, so in the following example, the string "TEST" will be displayed instead of "[object Object]". How to do it?
function TestObj() { this.sValue = "TEST"; } function Test() { var x = new TestObj(); document.write(x); }
source share