How to create a function that returns true if a letter in JavaScript

1 Answer

0 votes
let isAlpha = function(ch) {
  	return /^[A-Z]$/i.test(ch);
}
        
console.log(isAlpha('a'));

console.log(isAlpha(':'));



  
  
  
  
/*
run:
  
true
false
  
*/

 



answered Aug 25, 2022 by avibootz

Related questions

...