Search This Blog

2023/07/25

Check number is integer or not

 var num = 23.678


if(num == Math.floor(num)){
console.log("Integer")
}else{
console.log("Not An Integer")
}

if(num == Math.ceil(num)){
console.log("Integer")
}else{
console.log("Not An Integer")
}

output:
Integer Integer



No comments:

Post a Comment