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 199 views
199 views asked Aug 17, 2019 by avibootz
1 answer 76 views
1 answer 152 views
1 answer 109 views
2 answers 174 views
...