Skip to content

Instantly share code, notes, and snippets.

@ancyrweb
Created January 13, 2022 04:41
Show Gist options
  • Save ancyrweb/92f976f1eee4dfcfb571e8a92b30a439 to your computer and use it in GitHub Desktop.
Save ancyrweb/92f976f1eee4dfcfb571e8a92b30a439 to your computer and use it in GitHub Desktop.
const champions = [
{
name: "Darius",
level: 7,
},
{
name: "Katarina",
level: 12,
},
{
name: "Swain",
level: 9,
}
];
const hasExpectedLevel = (expectedLevel) => (champion) => champion.level >= expectedLevel;
const hasUltimate = hasExpectedLevel(6);
const chamionsAllHaveUltimate = champions.every(hasUltimate) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment