Skip to content

MIA-PTWD-Yandy-Gonzalez #147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add findBestArtist function
  • Loading branch information
ydnay committed Apr 13, 2018
commit f248bebcb69b2b8c88feceb490e3ebef4d6cd7ca
48 changes: 24 additions & 24 deletions starter-code/lib/abbeyRoad.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
artist: 'Richard Tauber',
month: 11,
year: 1933},
{song: 'Suits No. 1 & 2 Johann Sebastian Bach's Cello Suites',
{song: 'Suits No. 1 & 2 Johann Sebastian Bach\'s Cello Suites',
artist: 'Pablo Casals',
month: 11,
year: 1933},
{song: 'Suits No. 1 & 2 Johann Sebastian Bach's Cello Suites',
{song: 'Suits No. 1 & 2 Johann Sebastian Bach\'s Cello Suites',
artist: 'Pablo Casals',
month: 11,
year: 1936},
{song: 'I Can't Give You Anything but Love',
{song: 'I Can\'t Give You Anything but Love',
artist: 'Adelaide Hall and Fats Waller',
month: 08,
year: 1938},
Expand Down Expand Up @@ -53,7 +53,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Living Doll',
artist: 'Cliff Richard and The Shadows',
year: 1959},
{song: 'Travellin' Light',
{song: 'Travellin\' Light',
artist: 'Cliff Richard and The Shadows',
year: 1959},
{song: '100 Strings and Joni',
Expand All @@ -77,7 +77,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Apache',
artist: 'The Shadows',
year: 1960},
{song: 'Please Don't Tease',
{song: 'Please Don\'t Tease',
artist: 'Cliff Richard and The Shadows',
year: 1960},
{song: 'I Love You',
Expand All @@ -89,7 +89,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: '(Ghost) Riders in the Sky/Torquay',
artist: 'The Scorpions',
year: 1961},
{song: 'Rockin' at the Phil/Scorpio',
{song: 'Rockin\' at the Phil/Scorpio',
artist: 'The Scorpions',
year: 1961},
{song: 'Kon-Tiki',
Expand All @@ -107,7 +107,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'The Shadows',
artist: 'The Shadows',
year: 1961},
{song: 'It's Time to Say Goodnight',
{song: 'It\'s Time to Say Goodnight',
artist: 'Connie Francis',
year: 1961},
{song: 'Wonderful Land',
Expand Down Expand Up @@ -166,7 +166,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Aladdin and His Lamp',
artist: 'Cliff Richards and The Shadows',
year: 1964},
{song: 'A Hard Day's Night',
{song: 'A Hard Day\'s Night',
artist: 'The Beatles',
year: 1964},
{song: 'In The Hollies Style',
Expand Down Expand Up @@ -229,7 +229,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'For Certain Because',
artist: 'The Hollies',
year: 1967},
{song: 'Don't Stop Me Now',
{song: 'Don\'t Stop Me Now',
artist: 'Cliff Richard',
year: 1967},
{song: 'Cinderella',
Expand All @@ -247,7 +247,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Evolution',
artist: 'The Hollies',
year: 1967},
{song: 'Sgt. Pepper's Lonely Hearts Club Band',
{song: 'Sgt. Pepper\'s Lonely Hearts Club Band',
artist: 'The Beatles',
year: 1967},
{song: 'Odessey and Oracle',
Expand Down Expand Up @@ -286,7 +286,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Truth',
artist: 'Jeff Beck with Rod Stewart and Ronnie Wood',
year: 1968},
{song: 'The Beatles (aka 'The White song')',
{song: 'The Beatles (aka \'The White song\')',
artist: 'The Beatles',
year: 1968},
{song: 'Sincerely Cliff',
Expand Down Expand Up @@ -324,10 +324,10 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Shades of Rock',
artist: 'The Shadows',
year: 1970},
{song: 'Fela's London Scene',
{song: 'Fela\'s London Scene',
artist: 'Fela Kuti',
year: 1970},
{song: 'Tracks 'n Grooves',
{song: 'Tracks \'n Grooves',
artist: 'Cliff Richard',
year: 1970},
{song: 'About That Man',
Expand Down Expand Up @@ -424,7 +424,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Devil Woman',
artist: 'Cliff Richard',
year: 1976},
{song: 'I'm Nearly Famous',
{song: 'I\'m Nearly Famous',
artist: 'Cliff Richard',
year: 1976},
{song: 'Tales of Mystery and Imagination',
Expand All @@ -433,7 +433,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Year of the Cat',
artist: 'Al Stewart',
year: 1976},
{song: 'It'll Be Me Babe',
{song: 'It\'ll Be Me Babe',
artist: 'The Shadows',
year: 1976},
{song: 'Tasty',
Expand Down Expand Up @@ -469,7 +469,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'String of Hits',
artist: 'The Shadows',
year: 1979},
{song: 'Love Don't Live Here Anymore',
{song: 'Love Don\'t Live Here Anymore',
artist: 'Morrissey–Mullen',
year: 1979},
{song: 'Paradise Skies',
Expand Down Expand Up @@ -538,7 +538,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Phantom Manor at Disneyland Paris',
artist: 'Phantom Manor at Disneyland Paris',
year: 1990},
{song: 'Come l'acqua',
{song: 'Come l\'acqua',
artist: 'Mango',
year: 1992},
{song: 'Amused to Death',
Expand All @@ -563,7 +563,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
artist: 'Blur with Françoise Hardy',
year: 1995},
{song: 'Come Together',
artist: 'The Smokin' Mojo Filters',
artist: 'The Smokin\' Mojo Filters',
month: 9,
year: 1995},
{song: 'Everything Must Go',
Expand All @@ -575,7 +575,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Razorblade Suitcase',
artist: 'Bush',
year: 1996},
{song: 'Knockin' on Heaven's Door/Throw These Guns Away',
{song: 'Knockin\' on Heaven\'s Door/Throw These Guns Away',
artist: 'Dunblane',
year: 1996},
{song: 'Ultra',
Expand Down Expand Up @@ -680,7 +680,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Coldplay Live 2003',
artist: 'Coldplay',
year: 2003},
{song: 'Christmas Time (Don't Let the Bells End)',
{song: 'Christmas Time (Don\'t Let the Bells End)',
artist: 'The Darkness',
year: 2003},
{song: 'Free the Bees',
Expand Down Expand Up @@ -743,13 +743,13 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
{song: 'Time Machine',
artist: 'Mashina Vremeni',
year: 2008},
{song: 'Oogie Boogie's Song',
{song: 'Oogie Boogie\'s Song',
artist: 'Rodrigo y Gabriela',
year: 2008},
{song: 'Dig Out Your Soul',
artist: 'Oasis',
year: 2008},
{song: 'To Know That You're Alive',
{song: 'To Know That You\'re Alive',
artist: 'Kutless',
year: 2008},
{song: 'Running to Catch',
Expand Down Expand Up @@ -858,7 +858,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
artist: 'Scott Walker',
year: 2012},
{song: 'Sriwedari',
artist: 'Maliq & D'Essentials',
artist: 'Maliq & D\'Essentials',
year: 2013},
{song: 'Inside and Out',
artist: 'Lucinda Nicholls',
Expand All @@ -879,7 +879,7 @@ var abbeyRoadRecords = [{song: 'Land of Hope and Glory',
artist: 'Gigi',
year: 2014},
{song: 'The London Session',
artist: 'Umphrey's McGee',
artist: 'Umphrey\'s McGee',
year: 2014},
{song: 'Pirohia',
artist: 'Kerretta',
Expand Down
27 changes: 26 additions & 1 deletion starter-code/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,29 @@ let novemberArtists = function(arr) {
return arrOfArtists;
};

// console.log(novemberArtists(abbeyRoadRecords));
// console.log(novemberArtists(abbeyRoadRecords));

// Name of the artist who rocerded more songs
let findBestArtist = function(arr) {
let artistArr = [];
let recordCounter = 0;
let bestArtist = '';
let tempCounter = 1;
arr.forEach(obj => { artistArr.push(obj.artist); });
let sortedArtists = artistArr.sort();
for (let i = 0; i < sortedArtists.length; i++) {
if (sortedArtists[i] === sortedArtists[i + 1]) {
tempCounter++;
if (tempCounter > recordCounter) {
recordCounter = tempCounter;
bestArtist = sortedArtists[i];
}
} else {
tempCounter = 1;
}
}

return bestArtist;
};

// console.log(findBestArtist(abbeyRoadRecords));