Number Method Reference
Rounds a number up to the smallest integer greater than or equal to itself.
var ceil = 0.5.ceil(); // 1var ceil = -0.5.ceil(); // 0Parameters
Section titled “Parameters”None
Returns
Section titled “Returns”Number - For numbers above zero, rounds to the next whole number. For numbers below zero, rounds up towards zero.
Rounds a number down to the largest integer less than or equal to itself.
var floor = 0.5.floor(); // 0var floor = -0.5.floor(); // -1Parameters
Section titled “Parameters”None
Returns
Section titled “Returns”Number - For numbers above zero, rounds down to the nearest whole number. For numbers below zero, rounds down away from zero.
Returns the smallest of the two numbers.
var min = 10.min(1); // 1Parameters
Section titled “Parameters”other: Number - The other number to compare to.
Returns
Section titled “Returns”Number - The smallest of the two numbers.
Returns the largest of the two numbers.
var max = 10.max(1); // 10Parameters
Section titled “Parameters”other: Number - The other number to compare to.
Returns
Section titled “Returns”Number - The largest of the two numbers.
Returns only the integer part of a number.
var floor = 0.5.trunc(); // 0var floor = -0.5.trunc(); // 0Parameters
Section titled “Parameters”None
Returns
Section titled “Returns”Number - The integer part of the number, discarding the rest.