javascript check if string contains any numbers 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);
}