How to check if a string is alphabetic in JavaScript

1 Answer

0 votes
function isAlphabetic(str) {
  	return /^[a-zA-Z()]+$/.test(str);
}

console.log(isAlphabetic("javascript")); 
console.log(isAlphabetic("java script")); 
  
  
    
    
/*
run:

true
false
    
*/

  

 



answered Sep 18, 2021 by avibootz

Related questions

2 answers 203 views
203 views asked Aug 17, 2019 by avibootz
1 answer 83 views
1 answer 159 views
1 answer 117 views
2 answers 179 views
...