JavaScript import — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript import 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
Import a named value
easy10 minDestructure a named export from a simulated module.
- 2
Import and rename
easy10 minDestructure a value under a different local name.
- 3
Import a default export
easy10 minRead a default export under a local name of your choice.
- 4
Import everything as a namespace
easy10 minImport a whole module as one object and use two of its exports.
- 5
Import default and named together
medium10 minRead both the default and a named export from one module.
Find the bug(5)
- 1
Fix the wrong name imported
easy8 minThe destructured name does not match what the module exported.
- 2
Fix the default imported with braces
easy8 minA default export is imported without curly braces.
- 3
Fix the rename applied to the wrong side
easy8 minThe local variable should be renamed, not the source property.
- 4
Fix only one export imported
easy8 minDestructuring one name means the others are never brought into scope.
- 5
Fix the default and named mixed up
easy8 minThe default export and the named export were read from swapped keys.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace