Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check if number is integer js

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
 
PREVIOUS NEXT
Tagged: #check #number #integer #js
ADD COMMENT
Topic
Name
3+1 =