if string has a number return a value js code example Example: check if a string contains digits js function hasNumber(myString) { return /\d/.test(myString); }