Exercise
Extension: split the page into three files
Try the same app with separate files once your single-file version works.
Files
Prompt to start
This local app has index.html, styles.css and app.js. Here is the relevant code: [paste]. Change only the accent colour. Tell me which file to edit and give me the exact old and new line. Keep every behaviour the same.
Steps
- Download and unzip the starter. Keep all three files in the same folder. Open index.html and try a checkbox and Reset.
- Rename app.js to app-old.js. Reload the page and try the same checks. Compare the display with the behaviour.
- Restore the filename and reload. Ask a chatbot to change the accent colour without changing behaviour.
- Ask which file to change. Apply the change to a copy, then repeat the checks.
In this starter, index.html uses a relative stylesheet link and a classic script tag. Keeping the files together lets you open it from disk without a local web server.
Check your result
- The page still displays when its script is missing, but the count and Reset fail.
- Restoring the script restores both behaviours.
- Changing just the stylesheet changes the accent colour and preserves interaction.