-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut_61.html
64 lines (58 loc) · 2.06 KB
/
tut_61.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!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</title>
</head>
<body>
<div class="container">
<h1>This is math object tutorial</h1>
</div>
<script>
let m=Math;
console.log(m);
console.log("the value of Math.E is", Math.E);
console.log("the value of Math.LN2 is", Math.LN2);
console.log("the value of Math.LN10 is", Math.LN10);
console.log("the value of Math.LOG2E is", Math.LOG2E);
console.log("the value of Math.PI is", Math.PI);
console.log("the value of Math.SQRT2 is", Math.SQRT2);
// E: 2.718281828459045
// LN2: 0.6931471805599453
// LN10: 2.302585092994046
// LOG2E: 1.4426950408889634
// LOG10E: 0.4342944819032518
// PI: 3.141592653589793
// SQRT1_2: 0.7071067811865476
// SQRT2: 1.4142135623730951
// let a =34.654654;
// let b=89;
// console.log("the value of a and b is", a,b);
// console.log("the value of a and b rounded is ",Math.round(a), Math.round(b));
console.log("3 raise to power of 2 is ", Math.pow(3,2));
console.log("5 raise to power of 5 is ", Math.pow(5,5));
console.log("6 raise to power of 4 is ", Math.pow(6,4));
console.log("the squareroot of 64 is ", Math.sqrt(64));
// ceil and floor
console.log("5.8 rounded up to nearest integer is ", Math.ceil(5.8));
console.log("3 raise to power of 2 is ", Math.floor(5.8));
// absolute
console.log("the absolute value of 5.66 is ", Math.abs(-5.66));
console.log("3 raise to power of 2 is ", Math.pow(3,2));
// trigonometric function
console.log("the value of sin(pi) is ", Math.sin(Math.PI/2));
console.log("the value of sin(pi) is ", Math.sin(Math.PI/2));
console.log("the value of sin(pi) is ", Math.cos(Math.PI/2));
// min and max
console.log("minumum value of 4,5,6 is ",Math.max(3,4,5));
// random
let r =Math.random();
let a=1;
let b=100;
let r1_100 = a +(b-a)*Math.random();
console.log("the random number is ", r1_100);
</script>
</body>
</html>