How to check if any number is an integer or not in Javascript?
How to check if any number is an integer or not in Javascript?
374
28-Mar-2023
Updated on 28-Mar-2023
Amrita Bhattacharjee
28-Mar-2023The Number.isInteger() method can be used for checking whether a number is an integer or not in javascript.
Example of using Number.isInteger() in javascript is as follows:
Here the Number.isInteger() method is used for checking whether any number is an integer or not. If the code inside the if block gets executed then the number is an integer and otherwise if the code inside the block gets executed then the number is not an integer.