If I’m not mistaken, the question requires “contains number”, not “is number”. So:
function hasNumber(myString) {
return /\d/.test(myString);
}
More Related Contents:
- Evaluating a string as a mathematical expression in JavaScript
- How can I extract a number from a string in JavaScript?
- Why does JavaScript handle the plus and minus operators between strings and numbers differently?
- What’s the best way to convert a number to a string in JavaScript?
- Javascript Thousand Separator / string format [duplicate]
- Validate decimal numbers in JavaScript – IsNumeric()
- JavaScript string and number conversion
- Check if a number has a decimal place/is a whole number
- How to convert a String containing Scientific Notation to correct Javascript number format
- How can val() return Number?
- JavaScript adding a string to a number
- Javascript: How to retrieve the number of decimals of a *string* number?
- How do I replace a character at a particular index in JavaScript?
- How can I use backslashes (\) in a string?
- How to escape JavaScript in JSP?
- Testing whether a value is odd or even
- Remove insignificant trailing zeros from a number?
- Convert JavaScript String to be all lower case
- Efficient Javascript String Replacement
- Parsing numbers with a comma decimal separator in JavaScript
- Javascript string comparison fails when comparing unicode characters
- AngularJS: How do I manually set input to $valid in controller?
- HEX to Base64 converter for JavaScript
- how to convert a string to a Unix timestamp in javascript?
- Are ES6 template literals faster than string concatenation?
- How Can I Truncate A String In jQuery?
- Javascript / Jquery – Get number from string
- How to test if a URL string is absolute or relative?
- Print / display a JavaScript variable’s name instead of it’s value
- How to count the number of lines of a string in javascript