js if string have number code example
Example 1: check if a string contains digits js
function hasNumber(myString) {
return /\d/.test(myString);
}
Example 2: js string have number js
var hasNumber = /\d/;
hasNumber.test("ABC33SDF"); //true
hasNumber.test("ABCSDF"); //false