Skip to main content

JavaScript Syntax — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Syntax 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

    Write a complete statement

    easy10 min

    Declare a value and show the word "complete".

  2. 2

    Join strings correctly

    easy10 min

    Join "front" and "end" into one word.

  3. 3

    Use single and double quotes

    easy10 min

    Show a sentence that contains an apostrophe.

  4. 4

    Nest a function call

    easy10 min

    Uppercase the word "ok" and show it.

  5. 5

    Chain two operations

    medium10 min

    Trim the spaces then uppercase " done ".

Find the bug(5)

  1. 1

    Fix the unclosed string

    easy8 min

    A quote is missing, so the code never runs.

  2. 2

    Fix the mismatched quotes

    easy8 min

    The string opens with one quote style and closes with another.

  3. 3

    Fix the missing parentheses

    easy8 min

    The method is referenced but never called.

  4. 4

    Fix the wrong method spelling

    easy8 min

    The method name has the wrong capitalisation.

  5. 5

    Fix the stray comma

    easy8 min

    A comma where a semicolon belongs breaks the second statement.

Ready to write the code?

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

Open the workspace