The Precision Cutter
Easy+15 XP
Mission Briefing
The lumberjack robots are cutting too much wood! We need them to round down their measurements to the nearest whole log to avoid wasting resources.
The Concept: Floor Rounding
JavaScript has a built-in mathematical toolbox called the Math object. Math.floor(x) is a method that takes a decimal and forcefully rounds it down to the nearest whole integer.
The Objective
Your function receives a fractional number decimal.
- Use
Math.floor()to round the number down. - Return the resulting integer.
01EXAMPLE 1
Input
decimal = 4.9Output
4Constraints
- Use Math.floor().
FundamentalsMath
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
decimal4.9
Expected Output
4
Click RUN to test your solution