contents   index   previous   next



Number toString()

syntax:

number.toString([radix])

where:

radix - an optional radix, base number, determining the string representation of this number.

 

return:

string - a string representation of this number.

 

description:

This method behaves similarly to Number toLocaleString() and converts a number to a string using a standard format for numbers. If the radix is specified, the string will have digits representing that number base.

 

see:

Number toLocaleString()

 

example:

var n = 8.9;

var s = n.toString(); // "8.9"

 

var a = 16;

Screen.writeln(a.toString());   //"16"

Screen.writeln(a.toString(10)); //"16"

Screen.writeln(a.toString(16)); //"10"

Screen.writeln(a.toString(15)); //"11"

Screen.writeln(a.toString(8));  //"20"

Screen.writeln(a.toString(2));  //"10000"