Skip to content

Instantly share code, notes, and snippets.

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