-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.js
More file actions
25 lines (25 loc) · 711 Bytes
/
math.js
File metadata and controls
25 lines (25 loc) · 711 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
// *PI
console.log(Math.PI);
// *trunc
console.log(Math.trunc(Math.PI));
// *round
console.log(Math.round(Math.PI));
console.log(Math.round(5.258));
//* ceil
console.log(Math.ceil(7.2));
console.log(Math.ceil(Math.PI));
// *floor
console.log(Math.floor(Math.PI));
//*pow
console.log(Math.pow(7, 2));
//*min
console.log(Math.min(2, 0.2, 0.3, 0.5, 8));
//*max
console.log(Math.max(2, 0.2, 0.3, 0.5, 8));
//* random
console.log(Math.floor(Math.random() * 10) + 1);
console.log(Math.floor(Math.random() * 10) + 1);
console.log(Math.floor(Math.random() * 10) + 1);
console.log(Math.floor(Math.random() * 10) + 1);
const anyname = "amir Hosen"
console.log(anyname.charAt(Math.floor(Math.random() * anyname.length)));