We have already explored how to incorporate audio and video files into our HTML, but we can also control the playback and various properties of these media assets using JavaScript.
A little additional logic and reading the paused property from the audio HTML element allows us to toggle playing and pausing the audio with a single button. Note that we need to use the vanilla JavaScript document.querySelector() method to access the HTML media element in order to have access to the paused property.