Skip to main content

Part 7: Modularize the Application (extra credit)

For 2 points of extra credit, modularize the code into separate files.

Separate the game logic into the main.js file and game.js file. Such that the game.js file only contains the game logic and the main.js file contains the code that interacts with the DOM and the user input.

The main.js file should import the game.js file and use the functions exported from the game.js file to run the game.

  • modify the script in the html file to import the main.js file only as a module.