Validate Capitalization Usage



Given a word, determine if it correctly uses capital letters according to the following rules:

  • The entire word is in uppercase (e.g., "JEFF")
  • The entire word is in lowercase (e.g., "elon")
  • Only the first letter is in uppercase, and the rest are in lowercase (e.g., "Zuck").

The function returns true if the word adheres to one of these rules and false otherwise.


isCorrectCapitalization("BANANA") // true // Why? The word is entirely in uppercase isCorrectCapitalization("bAnAnA") // false // Why? Mixed capitalization is used incorrectly