Numbers & Math
JavaScript has one number type for integers and decimals.
Special Values
Infinity— dividing by 0NaN— invalid math
Math Object
Math.round(), Math.floor(), Math.ceil(), Math.random(), Math.max(), Math.abs()
JavaScript has one number type for integers and decimals.
Infinity — dividing by 0NaN — invalid mathMath.round(), Math.floor(), Math.ceil(), Math.random(), Math.max(), Math.abs()
(9.99 * 3).toFixed(2); // '29.97'
Math.floor(4.9); // 4
Math.random(); // 0.0–0.9999
Math.floor(Math.random()*6)+1; // dice roll
More in JavaScript