Last active
October 23, 2024 15:32
-
-
Save desinas/711d73d1bb331652bc7e30bce35ebba1 to your computer and use it in GitHub Desktop.
Murder Mystery Quiz (3-4) Udacity Lesson 12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Programming Quiz: Murder Mystery (3-4) | |
| */ | |
| // change the value of `room` and `suspect` to test your code | |
| var room = "dining room"; | |
| var suspect = "Mr. Parkes"; | |
| var weapon = ""; | |
| var solved = false; | |
| if (room === "ballroom" && suspect === "Mr. Kalehoff") { | |
| weapon = "poison"; solved = true; | |
| } else if (room === "gallery" && suspect === "Ms. Van Cleve") { | |
| weapon = "trophy"; solved = true; | |
| } else if (room === "billiards room" && suspect === "Mrs. Sparr") { | |
| weapon = "pool stick"; solved = true; | |
| } else { | |
| weapon = "knife"; solved = true; | |
| } | |
| if (solved) { | |
| console.log(suspect + " did it in the " + room + " with the " + weapon + "!"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
why is the initial value false