2.1.92 [ECMA-262-1999] Section, Number.prototype.toString (radix)


  1. __If radix is null or undefined, throw a TypeError exception.__

  2. __Let radNumber be the result of calling ToNumber with radix as the argument.__

  3. __If radNumber is NaN, throw a TypeError exception.__

  4. __Let radInteger be the result of calling ToInteger with radNumber as the argument.__

  5. If radix __is not present or radInteger__ is the number 10 #or undefined#, then this number value is given as an argument to the ToString operator; the resulting string value is returned.

  6. If radInteger #radix# is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation-dependent.

For JScript 5.x the result string consists of a representation of this number value expressed using the radix that is the value of radInteger. Letters a-z are used for digits with values 10 through 35. The algorithm used to generate the string representation is the algorithm specified in [ECMA-262-1999] section 9.8.1 generalized for radixes other than 10.

  1. __Otherwise throw a TypeError exception.__

The toString function is not generic; it throws a TypeError exception if its this value is not __a Number or__ a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.