What is the purpose of the defer attribute in ‘script’ tags?

defer delays script execution until the HTML document is fully parsed, improving page load performance.

Example:

<script src="script.js" defer></script>