Skip to content

Instantly share code, notes, and snippets.

@gusmcnair
Created October 1, 2019 19:11
Show Gist options
  • Save gusmcnair/06f9a94d8b1dc54f5eed89b627c06dee to your computer and use it in GitHub Desktop.
Save gusmcnair/06f9a94d8b1dc54f5eed89b627c06dee to your computer and use it in GitHub Desktop.
Application logic drills
Traffic lights drill
function doTrafficLights() {
const activeLight = getActiveLight();
if (activeLight === "red"){
turnRed();
}
else if (activeLight === "yellow"){
turnYellow();
}
else {
turnGreen();
}
}
Error alert drill
function main() {
try { doAllTheThings();
} catch(error){
const e = error;
console.error;
reportError(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment