Skip to content

isAlpha ​

The isAlpha function checks if a string contains only alphabetic characters (letters), without numbers or symbols.

Syntax ​

javascript
isAlpha(value)

Parameters ​

ParameterTypeDescription
valuestringThe string to be checked.

Return ​

TypeDescription
booleanReturns true if the string contains only letters, otherwise returns false.

Examples ​

javascript
isAlpha('abc');      // true
isAlpha('ABC');      // true
isAlpha('abc123');   // false
isAlpha('abc!');     // false
isAlpha('áéíóú');    // true
isAlpha('');         // false

Notes ​

  • Throws a TypeError if the provided value is not a string.
  • Supports Unicode characters (accents, letters from other alphabets).

References ​

Released under the MIT License.