JSFiddle - React, Tailwind, and code Playground

HTML

<audio id="audio" controls preload></audio>

JavaScript

var audioEl = document.getElementById('audio'),
    counter = -1,
    songs = [
        'http://forestmist.org/wp-content/uploads/2010/04/html5-audio-loop.mp3',
        'http://www.quackit.com/music/good_enough.mp3',
        'http://forestmist.org/wp-content/uploads/2010/04/html5-audio-loop.mp3',
        'http://www.quackit.com/music/good_enough.mp3'];

function nextSong() {
    audioEl.removeEventListener('ended', nextSong);

    if (songs[++counter]) {
        audioEl.src = songs[counter];
        audioEl.addEventListener('ended', nextSong);
        audioEl.play();
    } else {
        alert('All done!');   
    }
}

nextSong();