isUpperCase
Checks if a string contains at least one uppercase letter and no lowercase letters.
Syntax
typescript
isUpperCase(str: string): booleanParameters
| Parameter | Type | Description |
|---|---|---|
str | string | The string to be checked. |
Returns
| Type | Description |
|---|---|
boolean | true if the string contains at least one uppercase letter and no lowercase letters, otherwise false. |
Example
typescript
isUpperCase("ABC"); // true
isUpperCase("aBC"); // false
isUpperCase("123"); // false
isUpperCase(""); // falseNotes
- Throws
TypeErrorif the argument is not a string. - Spaces are ignored in the check.
