Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check if number is integer

const int = 10;
const float = 10.5;

console.log(Number.isInteger(int)); // true
console.log(Number.isInteger(float)); // false

// Explanation
// The Number.isInteger() method returns true 
// if a value is an integer of the datatype Number. 
// Otherwise it returns false 
// Source: https://www.w3schools.com/jsref/jsref_isinteger.asp
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #check #number #integer
ADD COMMENT
Topic
Name
4+4 =