Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. //Traffic light- using conditional statements to change the activeLight variable
  2. function doTrafficLights() {
  3. const activeLight = getActiveLight();
  4. if(activeLight === 'red') {
  5. return turnRed();
  6. }
  7. else if(activeLight === 'yellow') {
  8. return turnYellow();
  9. }
  10. else {
  11. return turnGreen();
  12. }
  13.  
  14. // console.log(activeLight);
  15.  
  16. }
  17.  
  18. //Error alert using the try/catch block logical statement
  19. try {
  20. doAllTheThings();
  21. } catch(error) {
  22. console.dir(error);
  23. reportError(error);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement