check if a string contains numbers code example
Example 1: check if string contains numbers
str.matches(".*\\d.*");
Example 2: check if string contains anything other than numbers
String.prototype.isNumber = function(){return /^\d+$/.test(this);}
console.log("123123".isNumber()); // outputs true
console.log("+12".isNumber()); // outputs false