JavaScript export — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript export 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
Export two named values
easy10 minSimulate a module exporting a function and a constant.
- 2
Export a default value
easy10 minSimulate a default export and use it.
- 3
Export a renamed value
easy10 minExport a function under a different public name.
- 4
Export a list of functions
easy10 minExport two already-declared functions together.
- 5
Combine named and default
medium10 minExport both a default and a named value from the same module.
Find the bug(5)
- 1
Fix the export left off the object
easy8 minThe function was declared but never added to the exports.
- 2
Fix the default read as a named export
easy8 minThe default export is read from the default key, not by its function name.
- 3
Fix the wrong name exported
easy8 minThe export list uses the wrong key for the renamed function.
- 4
Fix only one function exported
easy8 minBoth functions were meant to be exported, not just one.
- 5
Fix the default overwritten by a named export
easy8 minThe named export used the same key as the default, replacing it.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace