javascript test number for amount code example
Example 1: check if input is a number javascript
// Another option is typeof which return a string
if (typeof(val) === 'number') {
// Guess what, it's a bloody number!
}
Example 2: javascript check if a value is an int
// The Number.isInteger() checks to see if the passed value is an integer
// Returns true or false
Number.isInteger(2); //True
Number.isInteger(90); //True
Number.isInteger("37"); //False
Number.isInteger(false); //false