Number IsInteger
Multiple Choice Easy
Question
What does Number.isInteger(3.0) return?
Hint
3.0 is an integer in JS.
Explanation
Number.isInteger(3.0) returns true because 3.0 is the same as 3 in JavaScript (there is no separate integer type). Number.isInteger(3.5) returns false. This method is more precise than typeof x === "number" && x % 1 === 0 because it correctly handles Infinity and NaN (both return false).
Related Resources
Related Lessons
- Data Types
Learn JS data types.
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.