Created
November 5, 2021 15:16
-
-
Save SamWSoftware/8115e21b4f7c3ceaab388aef2b557942 to your computer and use it in GitHub Desktop.
Incorrect Use of Global Variables
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
let config = { | |
minimumScore: 50, | |
}; | |
exports.handler = async (event) => { | |
const { score, mode } = event; | |
let minimumScore = config.minimumScore | |
if ( mode === 'hard') { | |
minimumScore = 25; | |
} | |
if (score < minimumScore ){ | |
return `You need to score higher to get onto the ${mode} leaderboard. ${score}/${minimumScore}`; | |
} | |
return `Congratuations! You made it onto the ${mode} leaderboard. ${score}/${minimumScore}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment