Skip to main content

JavaScript super Keyword — exercises and bug fixes

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

    Call the parent constructor

    easy10 min

    Pass the name up to the parent with super.

  2. 2

    Call a parent method

    easy10 min

    Use super.describe to build on the parent's answer.

  3. 3

    Add a property after super

    easy10 min

    Call super first, then set the child's own property.

  4. 4

    Rely on the automatic super

    easy10 min

    Leave the child constructor out and let the arguments pass through.

  5. 5

    Wrap the parent's work

    medium10 min

    Have the child add to what the parent method returns.

Find the bug(5)

  1. 1

    Fix the missing super call

    easy8 min

    A child constructor must call super before using this.

  2. 2

    Fix this used before super

    easy8 min

    The instance does not exist until super has run.

  3. 3

    Fix the parent method rewritten

    easy8 min

    The child duplicates the parent instead of calling it.

  4. 4

    Fix super called as a method

    easy8 min

    In a constructor super is called directly, not as super.constructor.

  5. 5

    Fix the wrapped message lost

    easy8 min

    The child should pass its extra text through the parent method.

Ready to write the code?

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

Open the workspace