Q:

Modify array to not play randomly

I'm trying to not play in a random order and just play in the order of the array instead and loop back. Does anyone know how to modify this?
I'm very new to javascript, so sorry if this question is horrible to even ask haha. 
Thank you for your help!  
<div id="player"></div>

<script src="http://www.youtube.com/player_api"></script>

<script>

    var videos = [
      '3H3odKtfrTo',
      'BxjMGiN0jJY',
      'iGC9n0NAvDU'
    ]

    var index=Math.floor(Math.random() * videos.length);

    // create youtube player
    var player;
    function onYouTubePlayerAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: '9yT7KcHCrRY',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
    }

    // autoplay video
    function onPlayerReady(event) {
        event.target.playVideo();
    }

    function playNewVideo(id){
      player.loadVideoById(videos[index]);
      event.target.playVideo();
      playNewVideo(randomID)
    }

    // when video ends
    function onPlayerStateChange(event) {        
        if(event.data === 0) { 
          //generate new random number
          index=Math.floor(Math.random() * videos.length);
          playNewVideo();
        }
    }

</script>

A:

Just do:
// In the beginning
var index = 0
// After video is done playing.
index += 1
if(index < videos.length) { // If its not the last item on the list
    playNewVideo()
} else {
    // Go back to the start
    index = 0
    playNewVideo()
}

If you want to start on a random video and then play according to the list do:
// In the beginning
var index = Math.floor(Math.random() * videos.length)

