Something I've tried hard to explain to juniors getting used to web development is that the server is a program, that prepares another program and sends it to the browser to run.
Especially when adding JS to HTML pages, some juniors can be confused about what code is running where and what to expect is possible. Combine this with traditional server rendering approaches like PHP, where you could actually just stick a SQL statement inside some JS source text as it is being generated, and you get a recipe for confusion.
Emphasizing that HTML (including CSS and JS) is a piece of text that is shipped across to the browser and then run as a program is the way I worked out to try to explain what's happening.
Something I've tried hard to explain to juniors getting used to web development is that the server is a program, that prepares another program and sends it to the browser to run.
Especially when adding JS to HTML pages, some juniors can be confused about what code is running where and what to expect is possible. Combine this with traditional server rendering approaches like PHP, where you could actually just stick a SQL statement inside some JS source text as it is being generated, and you get a recipe for confusion.
Emphasizing that HTML (including CSS and JS) is a piece of text that is shipped across to the browser and then run as a program is the way I worked out to try to explain what's happening.