check string number javascript code example
Example 1: js check if string is integer
function isInt(str) {
return !isNaN(str) && Number.isInteger(parseFloat(str));
}
Example 2: how to check if a string is an integer javascript
isNaN(num) // returns true if the variable does NOT contain a valid number