Math.toString()
JavaScript 1.0+, JScript 3.0+ Nav2+, NES2+, IE4+ Syntax
math.toString()
Description
The toString() method of the Math object returns a string value representing the object.
Example
Listing 6.178 shows how the toString() method is used to get a string value representing the Math object.
Listing 6.178 Example of the toString() Method
<html> <body> <script language="JavaScript"> <!–– Hide // function returns string representation of math object function copy(){ var result = Math.toString(Math.sqrt(45)); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> <input type="button" value="Get String" onClick='copy()'> <br> The result of toString is: <input type="text" name="answer" size=20> </form> ... |
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.