-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut61-MathFn.html
57 lines (44 loc) · 1.8 KB
/
tut61-MathFn.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
<!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 Functions</title>
</head>
<body>
<h1>Math Functions</h1>
<script>
let m =Math;
console.log(m);
console.log('The value of PI : ',Math.PI);
console.log('The value of E : ',Math.E);
console.log('The value of LOG2E : ',Math.LOG2E);
let a = 34.56;
let b= 67;
let c=[10,20,30,40];
console.log('The value of a and b : ',a,b);
console.log('The rounded value of a and b : ',Math.round(a),Math.round(b));
console.log('The floor value of a : ',Math.floor(a));
console.log('The ceil value of a : ',Math.ceil(a));
console.log('The square root of 36 : ',Math.sqrt(36));
console.log('The square root of 45 : ',Math.sqrt(45));
console.log('The value of 2 raise 4 : ',Math.pow(2,4));
console.log('The value of 4 raise 3 : ',Math.pow(4,3));
console.log('The absolute value of -5.56 : ',Math.abs(-5.56));
console.log('The max value of 4,5,6,7 : ',Math.max(4,5,6,7));
console.log('The min value of 4,5,6,7 : ',Math.min(4,5,6,7));
console.log('The mav value of c : ',Math.max(...c));
console.log('The min value of c : ',Math.min(...c));
console.log('The value of sin(10) : ',Math.sin(10));
console.log('The value of cos(10) : ',Math.cos(10));
console.log('The value of tan(10) : ',Math.tan(10));
let r = Math.random();
console.log('The random value 0-1 : ',r);
let x=1;
let y=100;
let ran = x+(y-x)*Math.random();
console.log('The random value 0-1 : ',ran);
</script>
</body>
</html>