- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.html
More file actions
Latest commit
99 lines (74 loc) · 2.08 KB
/
Copy pathmath.html
File metadata and controls
99 lines (74 loc) · 2.08 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>demo</title>
</head>
<body>
<h4>Math.round()</h4>
<pid="demo"></p>
<pid="demo3"></p>
<script>
document.getElementById('demo').innerHTML=(457.424).toFixed();
document.getElementById('demo3').innerHTML=Math.round(457.424);
</script>
<h4>Math.pow()</h4>
<pid="demo1"></p>
<script>
document.getElementById('demo1').innerHTML=Math.pow(3,4);
</script>
<h4>Math.sqrt()</h4>
<pid="demo2"></p>
<script>
document.getElementById('demo2').innerHTML=Math.sqrt(9);
</script>
<h4>Math.abs()</h4>
<pid="demo4"></p>
<script>
document.getElementById('demo4').innerHTML=Math.abs(-10.11);
</script>
<h4>Math.ceil()</h4>
<pid="demo5"></p>
<script>
document.getElementById('demo5').innerHTML=Math.ceil(4.2);
</script>
<h4>Math.floor()</h4>
<pid="demo6"></p>
<script>
document.getElementById('demo6').innerHTML=Math.floor(4.2);
</script>
<h4>Math.min()? [250, 100, -50, -100, -350, -87]</h4>
<pid="demo7"></p>
<script>
varmm=[250,100,-50,-100,-350,-87];
//var mmm = Math.min(...mm);
varmmm=Math.min.apply(null,mm);
document.getElementById('demo7').innerHTML=mmm;
</script>
<h4>Math.max()? [250, 100, -50, -100, -350, -87]</h4>
<pid="demo8"></p>
<script>
varmmX=[250,100,-50,-100,-350,-87];
varmx=Math.max(...mmX);
document.querySelector('#demo8').innerHTML=mx;
</script>
<h4>Math.random()? 0 to 9</h4>
<pid="demo9"></p>
<script>
varmr=Math.floor(Math.random()*10+1);
document.querySelector('#demo9').innerHTML=mr;
</script>
<h4>Math.random()? 15 to 20</h4>
<pid="demo10"></p>
<buttononclick="mfFunc(0, 200);">Click</button>
<script>
functionmfFunc(min,max){
varmF=Math.round(Math.random()*(max-min));
document.getElementById('demo10').innerHTML=mF;
}
</script>
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
</body>
</html>