Explain the difference between internal and external Javascript?
S.no | Inline scripts | External scripts |
---|---|---|
1. | It loaded in the same page so not necessary to trigger another request. | It gives better separation of concerns and maintainability. |
2. | These scripts executed immediately | External script is downloaded by the browser & stores it in the cache. |
3. | async and defer attributes did not use | async and defer attributes can be use |
4. | It is helpful when we are using a server side dynamic rendering | It can be used to load browser side code on demand & reduce overall download time and size. |
BY Best Interview Question ON 13 Jan 2019