JS Built-ins
NumberisIntegerbeginner

Number.isInteger() β€” 4.0 is an integer

πŸ“– Usage Example
// Check if a value is an integer
Number.isInteger(42)    // β†’ true
Number.isInteger(42.5)  // β†’ false
Number.isInteger('42')  // β†’ false

Use Number.isInteger() to verify that a value is a whole number, without type coercion.

Number.isInteger() β€” 4.0

4.0 and 4 are the same in JavaScript β€” both are integers.

πŸ’‘ Hints (1)
  • β€’ In JavaScript, `4.0 === 4` β€” they are the same value.