-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path04-Math.js
32 lines (23 loc) · 865 Bytes
/
04-Math.js
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
function mathMethods(value) {
console.log("Original Value:", value);
let rounded = Math.round(value);
console.log("After round():", rounded);
let ceiling = Math.ceil(value);
console.log("After ceil():", ceiling);
let flooring = Math.floor(value);
console.log("After floor():", flooring);
let randomValue = Math.random();
console.log("After random():", randomValue);
let maxValue = Math.max(5, 10, 15);
console.log("After max():", maxValue);
let minValue = Math.min(5, 10, 15);
console.log("After min():", minValue);
let powerOfTwo = Math.pow(value, 2);
console.log("After pow():", powerOfTwo);
let squareRoot = Math.sqrt(value);
console.log("After sqrt():", squareRoot);
}
// Example Usage for Math Methods
mathMethods(4.56);
mathMethods(9);
mathMethods(25);