Search This Blog

Wednesday, September 21, 2022

Array iterators and working through nested objects and arrays - https://medium.com/@vshan0816/array-iterators-and-working-through-nested-objects-and-arrays-81e3f762e2ad

Array iterators and working through nested objects and arrays

const players = () => [...gameObject().home.players, ...gameObject().away.players]
const player = (name) => players().find(player => player.playerName === name)
const numPointsScored = (name) => {
return player(name).points
}
Which player has the most points? Call the function mostPointsScored.
Which team has the most points? Call the function winningTeam.
Which player has the longest name? Call the function playerWithLongestName.

No comments:

Post a Comment

Validating to select in sequencial order using angular

    < input type = "checkbox" (change) = "handleSelectTaskItem($event, taskItem)" [checked] = " taskItem . i...