RegExp.prototype.test()
to check if the given string matches against the alphabetic regexp pattern.const isAlpha = str => /^[a-zA-Z]*$/.test(str);
isAlpha('sampleInput'); // true
isAlpha('this Will fail'); // false
isAlpha('123'); // false
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️