| Corresponds To: 15.7.4.3-3.js |
| ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() |
| Returns this number value. |
| The valueOf function is not generic; it generates a runtime error if its |
| this value is not a Number object. Therefore it cannot be transferred to |
| other kinds of objects for use as a method. |
| Author: christine@netscape.com |
| var SECTION = "number-003"; |
| var TITLE = "Exceptions for Number.valueOf()"; |
| var testcases = new Array(); |
| writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); |
| var exception = "No exception thrown"; |
| VALUE_OF = Number.prototype.valueOf; |
| OBJECT = new String("Infinity"); |
| OBJECT.valueOf = VALUE_OF; |
| result = OBJECT.valueOf(); |
| exception = e.toString(); |
| testcases[tc++] = new TestCase( |
| "Assigning Number.prototype.valueOf as the valueOf of a String object " + |
| " (threw " + exception +")", |