Converting Inline-javascript to Javascript

Where you have:

<div id="playButton" onclick="//scripting code">

Move that scripting code in the onclick quotes, in to a function in a scripting area:

function buttonClickHandler(evt) {
  // scripting code 
}

Then attach it as an event handler to the button. Because they all started with on, such as onClick, or onChange, they removed the starting on and made them lowercase.

var playButton = document.querySelector("#playButton");
playButton.addEventListener("click", buttonClickHandler);

That’s how you move the scripts out of the inline event attribute, to a more appropriate scripting technique.