-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript_twelfth.html
More file actions
30 lines (26 loc) · 992 Bytes
/
JavaScript_twelfth.html
File metadata and controls
30 lines (26 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Math Object in JavaScript</title>
</head>
<body>
<h1>Math Object in JavaScript</h1>
<p id="para"></p>
<script>
let m = Math;
console.log(m);
console.log("The value of pi is:", m.PI);
console.log("2 to the power 5 is:", m.pow(2, 5));
console.log("Square root of 36 is: ", m.sqrt(36));
console.log("Square root of 50 is: ", m.sqrt(50));
console.log("The value of sin(pi/2) is: ", m.sin(m.PI/2));
// Generating a random number //
let r = m.random(); // generates a random number between 0 and 1 inclusive.
console.log("The random number is ",r);
// to generate a random number between a and b => a + (b - a)*m.random() //
</script>
</body>
</html>