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
Call the parent constructor
easy10 minPass the name up to the parent with super.
- 2
Call a parent method
easy10 minUse super.describe to build on the parent's answer.
- 3
Add a property after super
easy10 minCall super first, then set the child's own property.
- 4
Rely on the automatic super
easy10 minLeave the child constructor out and let the arguments pass through.
- 5
Wrap the parent's work
medium10 minHave the child add to what the parent method returns.
Find the bug(5)
- 1
Fix the missing super call
easy8 minA child constructor must call super before using this.
- 2
Fix this used before super
easy8 minThe instance does not exist until super has run.
- 3
Fix the parent method rewritten
easy8 minThe child duplicates the parent instead of calling it.
- 4
Fix super called as a method
easy8 minIn a constructor super is called directly, not as super.constructor.
- 5
Fix the wrapped message lost
easy8 minThe 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