Answers for "is integer check in js"

24

javascript is number an integer

Number.isInteger(value)

//returns a Boolean
Posted by: Guest on January-18-2020
1

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
Posted by: Guest on March-06-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language