-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJS15.html
More file actions
59 lines (47 loc) · 1.88 KB
/
JS15.html
File metadata and controls
59 lines (47 loc) · 1.88 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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>
// Printing the math object
let m = Math;
console.log(m)
// Printing the function of the math objct
let a = 34.9473;
let b = 22;
console.log("The value of a and b ",a,b);
// Round figure value
console.log("The value of a and b rounded is ", m.round(a), m.round(b));
// The power value
console.log("The power 3 raised 2 is", m.pow(3, 2));
// the square root of math function
console.log("The square root of 36 is", m.sqrt(36));
// ceiling and floor
console.log("The upper rounded value of", m.ceil(36.687));
console.log("The down rounded value of root ", m.floor(36.123));
// Absolute value math funstion and absolute value return always the positive value when we put negative it will transfrom into positive value
console.log("The absolute value of -5 is", m.abs(-5));
// Trignometry functions
console.log("The value of sin is ", m.sin(3));
console.log("The value of cos is ", m.cos(8));
console.log("The value of tan is ", m.tan(2,2));
// Minimum and maxium values function
console.log("The minimum value of 2,3,4,5,6,7 is ", m.min(2,3,4,5,6,7));
console.log("The maximum value of 2,3,4,5,6,7 is ", m.max(2,3,4,5,6,7));
// Generating a random number
let o = 1;
let p = 100;
let r1 = 0 + (p-o)*m.random( );
console.log("The random number is ", r1);
let r = m.random();
console.log("The random number is ", r);
</script>
</body>
</html>