Reputation: 3178
I am trying to understand the linking process in JavaScript in a browser environment. Feedback from the comments brought out more doubts.
Firstly, when they say JavaScript lacks a linker, who is doing the linking then?
When we use the script
tags, are we doing the linking explicitly or is the linking done at another time or skipped entirely?
As far as I understand, linking is a process of including compiled code or object files returned by a compiler into a single file. So using script
tags is linking or is it mere referencing to external .js
files?
I do not have a thorough understanding of the linking/loading process that happens behind the scenes in a Javascript environment.
I have read Crockford's blog posts and searched a few blogs but I couldn't find a definitive answer so as to why we need to use script
tags. Any details including language specifications would help.
Upvotes: 0
Views: 216
Reputation: 724572
No, it's an implication of JavaScript and HTML being two separate languages. Even so, the script element allows embedding of scripts into HTML files without linking to external .js files.
For external .js files, the script element is the linker, if you will (and even that is a stretch, considering that neither JavaScript nor HTML is "compiled" in the traditional sense of the word, but depending on whom you ask, code is code however you spin it).
Upvotes: 2