Skip to main content

JavaScript String Case — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the JavaScript String Case lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.

Exercises(5)

  1. 1

    Uppercase a name

    easy10 min

    Report the name in capitals.

  2. 2

    Lowercase a name

    easy10 min

    Report the name in lower case.

  3. 3

    Compare without case

    easy10 min

    Report that two differently-cased names match.

  4. 4

    Capitalise a word

    easy10 min

    Turn the word into a capitalised version.

  5. 5

    Search without case

    medium10 min

    Find the word regardless of how it is capitalised.

Find the bug(5)

  1. 1

    Fix the result thrown away

    easy8 min

    The method returns a new string; the original is unchanged.

  2. 2

    Fix the case-sensitive comparison

    easy8 min

    The two names differ only in case and should match.

  3. 3

    Fix the case-sensitive search

    easy8 min

    The search should ignore capitalisation.

  4. 4

    Fix the whole word capitalised

    easy8 min

    Only the first letter should change.

  5. 5

    Fix the missing rest of the word

    easy8 min

    The capitalised letter must be joined to the remaining characters.

Ready to write the code?

The editor, the automatic checks and the worked solutions open up with an account.

Open the workspace