Mega Code Archive

 
Categories / JavaScript Tutorial / Statement
 

With

Syntax with(object){       code;     } The with statement takes an object and refers to all of the properties, methods, and events of that object without directly referencing the object itself. <html>     <script language="JavaScript">     <!--     var myNum = 25;     var myE, mySin, mySqrt;     with (Math) {        myE = E;        mySqrt = sqrt(myNum)        document.writeln(mySqrt);        mySin = sin(PI/myNum);        document.write(mySin);     }     -->     </script> </html>