Skip to main content

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. 1

    Export two named values

    easy10 min

    Simulate a module exporting a function and a constant.

  2. 2

    Export a default value

    easy10 min

    Simulate a default export and use it.

  3. 3

    Export a renamed value

    easy10 min

    Export a function under a different public name.

  4. 4

    Export a list of functions

    easy10 min

    Export two already-declared functions together.

  5. 5

    Combine named and default

    medium10 min

    Export both a default and a named value from the same module.

Find the bug(5)

  1. 1

    Fix the export left off the object

    easy8 min

    The function was declared but never added to the exports.

  2. 2

    Fix the default read as a named export

    easy8 min

    The default export is read from the default key, not by its function name.

  3. 3

    Fix the wrong name exported

    easy8 min

    The export list uses the wrong key for the renamed function.

  4. 4

    Fix only one function exported

    easy8 min

    Both functions were meant to be exported, not just one.

  5. 5

    Fix the default overwritten by a named export

    easy8 min

    The 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