Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how would you check if a number is an integer in javascript

function isInt(num) {
  return num % 1 === 0;
}
console.log(isInt(4)); // true
console.log(isInt(12.2)); // false
console.log(isInt(0.3)); // false
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #number #integer #javascript
ADD COMMENT
Topic
Name
6+9 =