check if char is alphabetic javascript code example
Example 1: checking if a character is an alphabet in js
function isLetter(str) {
return str.length === 1 && str.match(/[a-z]/i);
}
Example 2: check for alphabetic string in javascript
function isAlphaOrParen(str) {
return /^[a-zA-Z()]+$/.test(str);
}