Libraries
-
Math.ceil()
-
- The
Math.ceil()
function returns the smallest integer greater than or equal to a given number. -
console.log(Math.ceil(.95)); // expected output: 1 console.log(Math.ceil(4)); // expected output: 4 console.log(Math.ceil(7.004)); // expected output: 8 console.log(Math.ceil(-7.004)); // expected output: -7
- The
-
-
Number.isInteger()
- The
Number.isInteger()
method determines whether the passed value is an integer. -
function fits(x, y) { if (Number.isInteger(y / x)) { return 'Fits!'; } return 'Does NOT fit!'; } console.log(fits(5, 10)); // expected output: "Fits!" console.log(fits(5, 11)); // expected output: "Does NOT fit!"
- The
永远渴望,大智若愚(stay hungry, stay foolish)