Last active
March 17, 2021 02:17
-
-
Save franciscomdelgado/df38abb1f66ac55ef915fa7f584d7616 to your computer and use it in GitHub Desktop.
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
// 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