Last active
August 7, 2020 20:12
-
-
Save brycetshaw/783d13a6df6b372e2335fa94cf12a630 to your computer and use it in GitHub Desktop.
maps integer array to promise array and resolves it to a single result
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
async function getNumDraws(year) { | |
const arrayOfScores = Array.from(Array(11).keys()); | |
return Promise.all(arrayOfScores.map(item => getTiesCountByNumberOfGoals(year, item))) | |
.then(drawsCountForEachScore => { | |
return drawsCountForEachScore.reduce((x, y) => x + y, 0); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment