7.21.6 toString Method

Converts a Number object or variable into a string using the specified radix.
Syntax
number.toString([radix])
Arguments
- number
- A Number object or variable. Cannot be a numeric literal
- radix
- An optional argument specifying the base to use when converting the number. Values between 2 and 16 inclusive are accepted. If not supplied, base 10 is used.
Remarks
Due to syntax restrictions, the toString method cannot be used on numeric literals. Values must be assigned to variables first. For example, the following code is invalid:
str=1997.toString();
This code must be rewritten:
var yr = 1997
str = yr.toString()
Copyright © 2000 Chili!Soft
|