August 1999
Intermediate to advanced
1488 pages
72h 53m
English
math.toSource()The toSource() method of the Math object is used to create 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.
Listing 6.177 shows how the toSource() method is used to make a copy of the Math object.
<html> <body> <script language="JavaScript"> <!–– Hide // function makes copy of math object function copy(){ var result = Math.toSource(Math.E); document.form1.answer.value = result; } // End Hide ––> </script> <form name=form1> Click on the button to create a copy of a Math object. <br><br> <input type="button" value="Copy" ... |
Read now
Unlock full access