by Sai gowtham

How to check value is not a number in javascript

How to check value is not a number in javascript

In JavaScript, we can use the Number.isInteger() method to check whether a given value is a number or not.

The Number.isInteger() method returns true whether a given value is number, otherwise it returns false.

Here is an example:

function isNumeric(value){
   return Number.isInteger(value);
}

isNumeric(1222); // true

isNumeric('1222'); // false

isNumeric('booo'); // false

If the given value is Infinity or not a number it returns false.

isNumeric(Infinity) //  false

isNumeric(-Infinity) //  false

isNumeric(0) // true

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course