Skip to content

Instantly share code, notes, and snippets.

@franciscomdelgado
Last active March 17, 2021 02:17
Show Gist options
  • Save franciscomdelgado/df38abb1f66ac55ef915fa7f584d7616 to your computer and use it in GitHub Desktop.
Save franciscomdelgado/df38abb1f66ac55ef915fa7f584d7616 to your computer and use it in GitHub Desktop.
// async await
const setHighScores = async ({username, numOfWind}) => {
try {
const highScoreDoc = await score.doc(userName);
const response = await highScoreDoc.update({numOfWins: increment});
} catch (e) {
console.log(e);
}
}
// call back "hell"
const setHighScores = ({username, numOfWind}) => {
score.doc(userName).then(highScoreDoc => {
highScoreDoc.update({numOfWins: increment})
.then(response => console.log(response))
.catch(err => console.log(err);
}).catch(err => console.log(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment