Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //drill 1
- function doTrafficLights() {
- const activeLight = getActiveLight();
- if (activeLight === "red") {
- turnRed();
- }
- else if (activeLight === "green") {
- turnGreen();
- }
- else {
- turnYellow();
- }
- }
- //drill 2
- function main() {
- try {
- doAllTheThings();
- }
- catch(e){
- console.error(e);
- reportError(e);
- }
- }
- function doAllTheThings() {
- throw {
- message: "Everything's ruined",
- name: "FatalException",
- toString: function() {
- return `${this.name}: ${this.message}`;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement