how to check number valid number in javascript code example
Example 1: if parameter is not number in js
let num1 = 'Hello';
if(isNaN(num1)){
console.log(num1 + ' is not a number');
} else{
console.log(num1 + ' is a number');
}
Example 2: js check if string or int
var myString = "abc123";
var otherString = "123";
/* isInterger() checks if an value repersents an int */
Number.isInteger(myString); //returns false
Number.isInteger(otherString); //returns true