Created
March 17, 2022 03:35
-
-
Save natafaye/3492017f305eec1c152858e1ae60521c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countDevelopers(list) { | |
return list.filter( d => d.continent === "Europe" && d.language === "JavaScript" ).length; | |
} | |
// OLD VERSION 3 | |
function countDevelopersOld3(list) { | |
return list.filter( developer => developer.continent === "Europe" && developer.language === "JavaScript" ).length; | |
} | |
// OLD VERSION 2 | |
function countDevelopersOld2(list) { | |
const europeanJS = list.filter( developer => developer.continent === "Europe" && developer.language === "JavaScript" ) | |
return europeanJS.length; | |
} | |
// OLD VERSION | |
function countDevelopersOld(list) { | |
let count = 0; | |
for(const developer of list) { | |
// if the developer is from Europe and their language is javascript | |
if(developer.continent === "Europe" && developer.language === "JavaScript") { | |
// increment the count | |
count++; | |
} | |
} | |
return count; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greetDevelopers(list) { | |
list.forEach(d => d.greeting = `Hi ${ d.firstName }, what do you like the most about ${ d.language }?` ) | |
return list; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isRubyComing(list) { | |
return list.some( developer => developer.language === "Ruby") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment