Is it possible to load audio dynamically with JavaScript?

To play all audio tags in loop

<script>
;(async function() {
  // AnkiMobile && AnkiDroid / Anki 2.1
  const elements = Array.from(document.querySelectorAll(".soundLink, .replacebutton"))
  const wait = t => new Promise(s => setTimeout(s, t))
  let index = 0
  do {
    const element = elements[index]
    element.click()
    await wait(2500)
    index++
    if (elems.length >= index) { index = 0 }
  } while(true)
})();
</script>