What is the difference between defer and async?
S.no | defer | async |
---|---|---|
1. | It downloads the file during the HTML parsing but executes the data after the parsing is completed. | It downloads the data during the HTML parsing, but it stops the parsing from executing the downloaded file. |
2. | Defer is used when the script relies upon another script. | Async is used if the script does not rely upon any scripts. |
BY Best Interview Question ON 30 Jan 2020