Skip to content

Instantly share code, notes, and snippets.

@SamWSoftware
Created November 5, 2021 15:16
Show Gist options
  • Save SamWSoftware/8115e21b4f7c3ceaab388aef2b557942 to your computer and use it in GitHub Desktop.
Save SamWSoftware/8115e21b4f7c3ceaab388aef2b557942 to your computer and use it in GitHub Desktop.
Incorrect Use of Global Variables
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