JavaScript Tutorial/Math/toSource

Материал из Web эксперт
Перейти к: навигация, поиск

Math.toSource()

The toSource() method creates a copy of the object.

It returns a string representation of an object, which can be passed to the eval method to create a copy of the object.



   <source lang="javascript">

<html>

   <body>
   <script language="JavaScript">
   
   </script>
   <form name=form1>
   Click on the button to create a copy of a Math object.
   

<input type="button" value="Copy" onClick="copy()">
The result of toSource is: <input type="text" name="answer" size=20> </form> </body> </html></source>