toString (Number - JavaScript)

Gets the string representation of a Number object.

Defined in

Number (Standard - JavaScript)

Syntax

toString() : string
Return value Description
string The string value of the Number object.

Examples

This example prints three numbers in string format.
function p(stuff) {
 	print("<<<" + stuff + ">>>");
}

var integer : Number;
var fixed : Number;
var flot : Number;

try {
	integer = new Number(54321);
	fixed = new Number(543.21);
	flot = new Number(54321E-2);
	p(integer.toString()); // prints <<<54321>>>
	p(fixed.toString()); // prints <<<543.21>>>
	p(flot.toString()); // prints <<<543.21>>>
	
} catch(e) {
	p("Error = " + e);
}