Answers for "javascript string contains number"

1

check if a string contains digits js

function hasNumber(myString) {
  return /\d/.test(myString);
}
Posted by: Guest on July-22-2020
1

js string have number js

var hasNumber = /\d/;   
      hasNumber.test("ABC33SDF");  //true
      hasNumber.test("ABCSDF");  //false
Posted by: Guest on December-10-2020
0

if string has number javascript

str = "hello123!"
if(/\d/.test(str))
  console.log(str+" has a number.")
Posted by: Guest on October-10-2021

Code answers related to "javascript string contains number"

Code answers related to "Javascript"

Browse Popular Code Answers by Language