Object.toString()

JavaScript 1.1+, ECMAScript 1.0+, JScript 3.0+ Nav3+, NES2+, IE4+, Opera3+ Syntax

							object.toString()

Description

The toString() method is used to get a string representation of the Number object.

Example

Listing 6.196 shows how the toString() method is used.

Listing 6.196 Example of the toString() Method
<html>
<body>

<script language="JavaScript">
<!––Hide
// creates a number object.
var aNum = Number(21);

// converts the number object to a string and outputs to document.
document.write(aNum.toString());
// End Hide ––>
</script>

</body>
</html>
							
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.