What is the difference between async and defer attributes in ‘script’?

async loads the script asynchronously and executes it immediately after loading, while defer loads and executes the script after the HTML document is parsed.