← Back to challenges

Check if the Same Case

JavaScriptHardstringsvalidation

Instructions

Create a function that returns true if an input string contains only uppercase or only lowercase letters.

Examples

sameCase("hello") ➞ true

sameCase("HELLO") ➞ true

sameCase("Hello") ➞ false

sameCase("ketcHUp") ➞ false

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Is the String in Order?