index.js
// make an object with just the things I'm interested in
make an object with just the things I'm interested in
make an object with just the things I ' m interested in
function makeTrackO(resp) {
  var trackObj = {};
  trackArr = [];
  for (var i=0; i<resp.tracks.length; i++) {
    for (prop in resp.tracks[i]) {
      if (prop === 'artists') {
        trackObj['artists'] = resp.tracks[i].artists[0].name;
      }
      if (prop === 'name') {
        trackObj['name'] = resp.tracks[i].name;
      }
      if (prop === 'preview_url') {
        trackObj['preview_url'] = resp.tracks[i].preview_url;
      }
      if (prop === 'popularity') {
        trackObj['popularity'] = resp.tracks[i].popularity;
      }
      if (prop === 'album') {
        trackObj['image'] = resp.tracks[i].album.images[1].url;
        trackObj['id'] = resp.tracks[i].album.id;
      }
    }
  trackArr.push(trackObj);
  trackObj = {}; 
  }
}
function makeTrackO ( resp ) { var trackObj = { } ; trackArr = [ ] ; for ( var i = 0 ; i < resp . tracks . length ; i ++ ) { for ( prop in resp . tracks [ i ] ) { if ( prop === 'artists' ) { trackObj [ 'artists' ] = resp . tracks [ i ] . artists [ 0 ] . name ; } if ( prop === 'name' ) { trackObj [ 'name' ] = resp . tracks [ i ] . name ; } if ( prop === 'preview_url' ) { trackObj [ 'preview_url' ] = resp . tracks [ i ] . preview_url ; } if ( prop === 'popularity' ) { trackObj [ 'popularity' ] = resp . tracks [ i ] . popularity ; } if ( prop === 'album' ) { trackObj [ 'image' ] = resp . tracks [ i ] . album . images [ 1 ] . url ; trackObj [ 'id' ] = resp . tracks [ i ] . album . id ; } } trackArr . push ( trackObj ) ; trackObj = { } ; } }
make an object with just the things I'm interested in
make an object with just the things I ' m interested in
// clear out the old contents