JavaScript의 간단한 Math.methods를 확인해보자.
console.log(Math.abs(3 - 5)); // 2
console.log(Math.abs(5 - 3)); // 2
console.log(Math.abs(3.5 - 5.7)); // 2.2
console.log(Math.ceil(.03)); // 1
console.log(Math.ceil(0.93)); // 1
console.log(Math.ceil(6.002)); // 7
console.log(Math.ceil(-6.002)); // -6
console.log(Math.ceil(null)); // 0
console.log(Math.floor(.93)); // 0
console.log(Math.floor(0.03)); // 0
console.log(Math.floor(6.002)); // 6
console.log(Math.floor(-6.002)); // -7
console.log(Math.floor(null)); // 0
console.log(Math.max(1, 2)); // 2
console.log(Math.max(1, 2, 3)); // 3
console.log(Math.max(-1, -3, -2)); // -1
const array1 = [1, 4, 2];
console.log(Math.max(...array1)); // 4
console.log(Math.min(1, 2)); // 1
console.log(Math.min(1, 2, 3)); // 1
console.log(Math.min(-1, -3, -2)); // -3
const array1 = [1, 4, 2];
console.log(Math.min(...array1)); // 1
console.log(Math.round(.93)); // 0
console.log(Math.round(0.03)); // 0
console.log(Math.round(6.002)); // 6
console.log(Math.round(-6.002)); // -6
console.log(Math.round(null)); // 0