Javascript: How to check if the variable is a number?

There are some ways for doing this but I think the following is the most easiest and convenient for use:

if (! isNaN(variable)) {
//code here

isNaN comes from is Not A Number and can be used for understanding if the variable is a number.

No comments:

Post a Comment