JSFiddle - React, Tailwind, and code Playground

HTML

<audio id="ambient"></audio>
<audio id="background"></audio>

JavaScript

const player = document.createElement("AUDIO");
player.setAttribute("id", "hello");
player.src = "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3";
player.play();
// This logs "hello".
console.log(player.id);
// This logs <audio id="hello" src="https://storage.googleapis.com/storybook-test-bucket/Prerendered/Moana-bg-1.m4a"></audio>
console.log(player);

let get_player;
let audio_list;
setTimeout(function() {
	get_player = document.getElementById("hello");
	audio = document.getElementsByTagName("audio"); 
	// This logs null.
  console.log(get_player);
  // This only displays "ambient" and "background" id'd audio elements.
  console.log(audio_list);
}, 1000);

// Try pausing and playing the audio element. It does not work.
setTimeout(function() { get_player.pause(); }, 5000);
setTimeout(function() { get_player.play(); }, 10000);