JavaScript in my HTML code won’t work when embedded in Google Sites

I’ve been making a slightly different version of 2048 to embed in my Google Site, but when I try to embed the HTML, the JavaScript part won’t work. When opening the HTML file directly in the browser it does work though.

Here is a link to the code:

https://sites.google.com/view/scoopmungus/html

Here is what the embedded part looks like currently:

https://sites.google.com/view/scoopmungus/fun-and-games/games/2048

Was just wondering what the problem was.