Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

javascript
communitycreator
character
lowercase

How to check if a character is lowercase in Javascript

Theodore Kelechukwu Onyejiaku

Characters hold ASCIIAmerican Standard Code for Information Interchange codes. ASCII was developed as a standard character set for computers and electronic devices.

These codes or numbers can also be called character codes or their equivalent number.

Using event.charCode

In Javascript, event.charCode, which is a property of the keyboard event keypress, prints the character code of any character on the keyboard.

Code

The example below reveals the charCode of any character entered in the input box below. The keypress event is used to determine the character pressed.

charCode range of lowecase characters

Alphabets have their charCode values in a particular range. Lowercase alphabets fall within the range of 97 - 122.


The trick to determine if a character is lowercase lies in knowing its value in the range 97 - 122.

How to check if a character is lowercase

Explanation

From the code above, we can see that any charChode that falls outside the range of 97 - 122 is not lowercase.

RELATED TAGS

javascript
communitycreator
character
lowercase

CONTRIBUTOR

Theodore Kelechukwu Onyejiaku
RELATED COURSES

View all Courses

Keep Exploring