check if a string has numbers javascript code example
Example 1: javascript is variable a string
if (typeof myVar === 'string'){
//I am indeed a string
}
Example 2: check if a string contains digits js
function hasNumber(myString) {
return /\d/.test(myString);
}