JavaScript: Test whether the character at the provided character index is lower case
JavaScript String: Exercise-44 with Solution
Is Character Lowercase
Write a JavaScript function to test whether the character at the given (character) index is lower case.
Test Data:
console.log(isLowerCaseAt ('Js STRING EXERCISES', 1));
true
Visual Presentation:

Sample Solution:
JavaScript Code:
Output:
true
Explanation:
In the exercise above,
- function isLowerCaseAt(str, index) {: This line declares a function named "isLowerCaseAt()" with two parameters: 'str' (the input string) and 'index' (the index of the character to check).
- return str.charAt(index).toLowerCase() === str.charAt(index);: This line checks if the character at the specified index in the input string, converted to lowercase, is equal to the original character at that index. It returns 'true' if the character is lowercase, and 'false' otherwise.
- console.log(isLowerCaseAt ('Js STRING EXERCISES', 1));: This line calls the "isLowerCaseAt()" function with the input string 'Js STRING EXERCISES' and index 1, and logs the result to the console. It checks if the character at index 1 (the second character) is lowercase.
Flowchart:

Live Demo:
For more Practice: Solve these Related Problems:
- Write a JavaScript function that tests if the character at a specified index of a string is lowercase by comparing it to its lowercase version.
- Write a JavaScript function that checks using charCodeAt() whether a letter falls within the lowercase ASCII range.
- Write a JavaScript function that validates the input and returns false if the index is invalid.
- Write a JavaScript function that accounts for non-letter characters and returns false if the character is not alphabetic.
Improve this sample solution and post your code through Disqus.
Previous: Write a JavaScript function to test whether the character at the provided (character) index is upper case.
Next: Write a JavaScript function to get humanized number with the correct suffix such as 1st, 2nd, 3rd or 4th.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics