Use with statement with Math object in JavaScript
Description
The following code shows how to use with statement with Math object.
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var myNum = 25;<!--from ww w. ja v a2s . c o m-->
var myE, mySin, mySqrt;
with (Math) {
myE = E;
mySqrt = sqrt(myNum)
document.writeln(mySqrt+"<br/>");
mySin = sin(PI/myNum);
document.write(mySin);
}
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial While
Check the loop counter for while loop in Ja...
Use Do while loop to reverse a string in Ja...
Use do...while loop and int number to contr...
Use integer variable to control the while l...
Use number to control do...while loop in Ja...
Use while loop to pop all elements in an ar...
Use while loop with an integer to control t...
Check the loop counter for while loop in Ja...
Use Do while loop to reverse a string in Ja...
Use do...while loop and int number to contr...
Use integer variable to control the while l...
Use number to control do...while loop in Ja...
Use while loop to pop all elements in an ar...
Use while loop with an integer to control t...