Mega Code Archive

 
Categories / JavaScript Tutorial / Math
 

Math toString()

The toString() method returns a string value representing the object. <html>     <body>     <script language="JavaScript">     <!--     function copy(){         var result = Math.toString(Math.sqrt(45));         document.form1.answer.value = result;     }     -->     </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>     </body>     </html>