Created
May 17, 2019 14:26
-
-
Save valentingavela/95e6cd7c1c16096bd1233b6f38c475c3 to your computer and use it in GitHub Desktop.
Javascript check if number is integer or float
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isInt(n){ | |
return Number(n) === n && n % 1 === 0; | |
} | |
function isFloat(n){ | |
return Number(n) === n && n % 1 !== 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment