Round a Number
Fill in the Blank Easy
Question
Fill in the blank to round 3.7 to the nearest integer.
Code
const result = Math.___(3.7);
console.log(result); // 4
Hint
The method rounds to the nearest integer (up or down).
Explanation
Math.round() rounds to the nearest integer: 3.7 rounds up to 4, 3.3 rounds down to 3, and 3.5 rounds up to 4 (rounds half up). Math.floor() always rounds down, and Math.ceil() always rounds up.
Related Resources
Related Lessons
- Numbers and Math
Learn about numbers and math operations.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.