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

1 Answer

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

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



  
  
  
  
/*
run:
  
true
false
  
*/

 



answered Aug 25, 2022 by avibootz

Related questions

1 answer 118 views
1 answer 165 views
1 answer 204 views
1 answer 144 views
2 answers 170 views
...