Math.floor

floor — Rounds down to the closest whole number.

Description

Math.floor(number number)

Parameters

Name Description Type Default Optional
number number No

Examples

Example #1 – floor example
console.log(Math.floor(1)); // 1 console.log(Math.floor(1.0)); // 1 console.log(Math.floor(1.2)); // 1 console.log(Math.floor(1.49)); // 1 console.log(Math.floor(1.5)); // 1 console.log(Math.floor(1.8)); // 1 console.log(Math.floor(2)); // 2

See also

External references