javascript find number in string code example
Example 1: javascript find a digit in str
var regex = /\d+/g;
var string = "Any string you want!";
var matches = string.match(regex); // creates array from matches
if (matches){
// There is a digit in the string.
} else {
// No Digits found in the string.
}
Example 2: how to find number in string javascript
var str = 10