---
title: "How to check if any number is an integer or not in Javascript?"  
description: "How to check if any number is an integer or not in Javascript?"  
author: "Amrita Bhattacharjee"  
published: 2023-03-28  
updated: 2023-03-28  
canonical: https://www.mindstick.com/forum/157610/how-to-check-if-any-number-is-an-integer-or-not-in-javascript  
category: "javascript"  
tags: ["javascript", "javascript object"]  
reading_time: 1 minute  

---

# How to check if any number is an integer or not in Javascript?

How to [check if](https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery) any number is an [integer](https://answers.mindstick.com/qa/113667/write-code-for-roman-to-integer) or not in [Javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)?

## Replies

### Reply by Amrita Bhattacharjee

The 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:

```javascript
let num = 10.5;

if (Number.isInteger(num)) {
  console.log("The number is an integer.");
} else {
  console.log("The number is not an integer.");
}
```

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.


---

Original Source: https://www.mindstick.com/forum/157610/how-to-check-if-any-number-is-an-integer-or-not-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
