Understand the language, browser host APIs, and when scripts execute.
- ECMAScript
- browser APIs
- script loading
- execution order
JavaScript is the language; the browser provides document, events, and storage APIs. A script runs statements in order and can change the page after HTML is parsed. Keep code in a separate file so behavior can be inspected independently.
Do not confuse the language specification with browser APIs; document is not part of core ECMAScript.
Open the example, inspect its script request, then move the script tag and explain when the code runs.
Open example.html in a browser and edit example.js. Save, refresh, and use the Console and debugger to inspect values.
- Explain the core idea in your own words without reading the code.
- Change one input and predict the output before running it.
- Test one boundary or failure case, then record what you changed.