-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath.js
More file actions
39 lines (33 loc) · 862 Bytes
/
math.js
File metadata and controls
39 lines (33 loc) · 862 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 4(JS Math)
// Gsearch - mdn math
// Math.pow[To the power]
const result = Math.pow(3, 8);
// console.log(result);
// Math.abs[It convert number value to positive]
const num1 = 25;
const num2 = 45;
const gap = Math.abs(num1 - num2);
// console.log(gap);
if(gap < 5){
console.log('you guys can be friends');
}
else{
console.log('you guys stay apart');
}
// Decimal converter
const number = 2.451245;
const fullNumber = Math.round(number);
// console.log(fullNumber);
const result2 = Math.ceil(2.00001);
const result3 = Math.floor(456.259);
// console.log(result3);
// Random number
// console.log(Math.random());
// console.log(Math.random());
// console.log(Math.random());
// console.log(Math.random());
// Let's play ludo by random number
for(let i = 0; i < 20; i++){
const random = Math.round(Math.random()*6);
console.log(random);
}