Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. //drill 1
  2.  
  3. function doTrafficLights() {
  4. const activeLight = getActiveLight();
  5. if (activeLight === "red") {
  6. turnRed();
  7. }
  8.  
  9. else if (activeLight === "green") {
  10. turnGreen();
  11. }
  12.  
  13. else {
  14. turnYellow();
  15. }
  16. }
  17.  
  18. //drill 2
  19.  
  20. function main() {
  21. try {
  22. doAllTheThings();
  23. }
  24. catch(e){
  25. console.error(e);
  26. reportError(e);
  27. }
  28. }
  29.  
  30. function doAllTheThings() {
  31. throw {
  32. message: "Everything's ruined",
  33. name: "FatalException",
  34. toString: function() {
  35. return `${this.name}: ${this.message}`;
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement