JavaScript Check if Number is Integer

Last Updated On Tuesday 2nd Nov 2021

javascript is integer

js isinteger.In JavaScript, isInteger() is a Number method that is used to return a Boolean value indicating whether a value is an integer.

Syntax

In JavaScript, the syntax for the isInteger() method is

	Number.isInteger(value);
	

Parameters or Arguments

  • value – The value to test whether it is an integer.

Returns

The isInteger() method returns true if the value is an integer. Otherwise, it returns false.

javascript isinteger

	console.log(Number.isInteger(64));
console.log(Number.isInteger(8.4));
console.log(Number.isInteger('53'));
	
  • 64 is an integer, its returns true
  • 8.4 is not an integer, its returns false
  • ’53’ is not a number and it does not convert the value to a number, its retunrs false
	// true
// false
// false