Last active
May 2, 2016 08:36
-
-
Save FagnerMartinsBrack/055ab2e73b793e2f8739 to your computer and use it in GitHub Desktop.
(Medium) Promises Are Not Proxies - Ideal World
This file contains 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
try { | |
const soccerMatches = fetchSoccerMatchesFromResource( ... ); | |
const soccerResults = fetchSoccerResultsFromResource( ... ); | |
const detailedMatches = soccerMatches.map(function( match ) { | |
return { | |
name: match.name, | |
score: findScoreForMatch( match, soccerResults ) | |
}; | |
}); | |
detailedMatches.forEach(function( detailedMatch ) { | |
const name = detailedMatch.name; | |
const score = detailedMatch.score; | |
console.log( `${name} with the score ${score}` ); | |
}); | |
} catch ( err ) { | |
console.error( 'Failed to print the score', err ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment