# External scripts If we have a lot of JavaScript code, we can it put it into a separate file. The script file is attached to HTML like this: ```html ``` Here `/path/to/script.js` is an absolute path to the file with the script (from the site root). It is also possible to provide a path relative to the current page. For instance, `src="script.js"` would mean a file `"script.js"` from the current folder. We can give a full URL al well, for instance: ```html ``` To attach several scripts, use multiple tags: ```html … ``` ```smart As a rule, only simplest scripts are put into HTML. More complex ones reside in separate files. The benefit of a separate file is that the browser will download it and then store in its [cache](https://en.wikipedia.org/wiki/Web_cache). After it, other pages which want the same script will take it from the cache instead of downloading it. So the file is actually downloaded only once. That saves traffic and makes pages faster. ``` ````warn header="If `src` is set, the script content is ignored." A single ` ``` We must choose: either it's an external ` ``` ```` ## Asynchronous scripts: defer/async Browser loads and shows HTML gradually as it comes. That's clearly noticeable on the slow internet connection. The browser doesn't wait for the page to load fully. It shows the part that has been loaded already, and then adds content to it as it loads. As we noted before, when the browser meets a ` */!*
Rabbits counted!