index.js
// call makeTrackDiv with 3 random top songs
call makeTrackDiv with 3 random top songs
call makeTrackDiv with 3 random top songs
function callTrack(tracks) {
  var randArr = [];
    while (randArr.length < 3) {
      var idx = Math.floor(Math.random() * tracks.length);
      if (!randArr.includes(idx)) { 
        randArr.push(idx);
      }
    }
  console.log('RANDARR:', randArr);
  addArtistHeader(tracks[0].artists);
  for (j=0; j<randArr.length; j++) {
    makeTrackDiv(tracks[randArr[j]]);
  }
  initSongListeners();
}
function callTrack ( tracks ) { var randArr = [ ] ; while ( randArr . length < 3 ) { var idx = Math . floor ( Math . random ( ) * tracks . length ) ; if ( ! randArr . includes ( idx ) ) { randArr . push ( idx ) ; } } console . log ( 'RANDARR:' , randArr ) ; addArtistHeader ( tracks [ 0 ] . artists ) ; for ( j = 0 ; j < randArr . length ; j ++ ) { makeTrackDiv ( tracks [ randArr [ j ] ] ) ; } initSongListeners ( ) ; }
call makeTrackDiv with 3 random top songs
call makeTrackDiv with 3 random top songs
// only add if num is unique