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: Laugh it Off 2 (5-2) | |
| * | |
| * Write a function called `laugh` with a parameter named `num` that represents the number of "ha"s to return. | |
| * | |
| * Note: | |
| * - make sure your the final character is an exclamation mark ("!") | |
| */ | |
| function laugh(num) { |
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: Laugh it Off 1 (5-1) | |
| */ | |
| // your code goes here | |
| function laugh() { | |
| var sound = "hahahahahahahahahaha!"; | |
| return sound; | |
| } | |
| console.log (laugh()); |
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: Find my Seat (4-8) | |
| * | |
| * Write a nested for loop to print out all of the different seat combinations in the theater. | |
| * The first row-seat combination should be 0-0 | |
| * The last row-seat combination will be 25-99 | |
| * | |
| * Things to note: | |
| * - the row and seat numbers start at 0, not 1 | |
| * - the highest seat number is 99, not 100 |
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: Factorials (4-7) | |
| */ | |
| // your code goes here | |
| var solution = 1; | |
| for (var x = 12; x > 0; x--) { | |
| solution *= x; | |
| } | |
| console.log(solution); |
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: Fix the Error 2 (4-6) | |
| */ | |
| // fix the for loop | |
| for (var k = 0; k < 200; k++) { | |
| console.log(k); | |
| } |
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: Fix the Error 1 (4-5) | |
| */ | |
| // fix the for loop | |
| for (var x = 5; x < 10; x++) { | |
| console.log(x); | |
| } |
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: Changing the Loop (4-4) | |
| */ | |
| // rewrite the while loop as a for loop | |
| /*var x = 9; | |
| *while (x >= 1) { | |
| * console.log("hello " + x); | |
| * x = x - 1; | |
| *} |
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
| */ | |
| // your code goes here | |
| var x = 60; | |
| while (x >= 0) | |
| { | |
| if (x === 50) { | |
| console.log("Orbiter transfers from ground to internal power"); |
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: 99 Bottles of Juice (4-2) | |
| * | |
| * Use the following `while` loop to write out the song "99 bottles of juice". | |
| * Log the your lyrics to the console. | |
| * | |
| * Note | |
| * - Each line of the lyrics needs to be logged to the same line. | |
| * - The pluralization of the word "bottle" changes from "2 bottles" to "1 bottle" to "0 bottles". | |
| */ |
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 = "ballroom"; | |
| var suspect = "Mr. Kalehoff"; | |
| var weapon = ""; | |
| var solved = false; |