I'd like to add to the @paso_sb some other points:
1/ Give a clear name to your HTML Embed (code) => ex. :
[purpose] script
where purpose can be "animation", "reveal"...
2/ Don't reveal sensitive informations in an HTML Embed (ex. : API Key, passwords...) because it's frontend!
3/ Don't hesitate to document your code (easier to maintain)
4/ If you use a script don't forget to toggle "Client only" (
https://docs.webstudio.is/university/core-components/html-embed)
5/ When you use variables in a script don't forget to use <script type="module"></script> to avoid side effects.
6/ Some scripts will be added to the header (go to Project Settings > Custom Code to add the script)