Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Traffic light- using conditional statements to change the activeLight variable
- function doTrafficLights() {
- const activeLight = getActiveLight();
- if(activeLight === 'red') {
- return turnRed();
- }
- else if(activeLight === 'yellow') {
- return turnYellow();
- }
- else {
- return turnGreen();
- }
- // console.log(activeLight);
- }
- //Error alert using the try/catch block logical statement
- try {
- doAllTheThings();
- } catch(error) {
- console.dir(error);
- reportError(error);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement