| <p>This page tests that string addition prefers valueOf() over toString() for conversion. If the test passes, you'll see a PASS message below.</p> |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| function shouldBe(a, aDescription, b) |
| log("PASS: " + aDescription + " should be " + b + " and is."); |
| log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + "."); |
| valueOf: function valueOf() { return 0; }, |
| toString: function toString() { return 1; } |
| shouldBe('1' + valueOfIsZero, "'1' + valueOfIsZero", "10"); |