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: Build A Triangle (5-3) | |
| */ | |
| // creates a line of * for a given length | |
| function makeLine(length) { | |
| var line = ""; | |
| for (var j = 1; j <= length; j++) { | |
| line += "* "; | |
| } |
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 (5-4) | |
| */ | |
| var laugh = function(times) { | |
| var haTimes= ""; | |
| while (times > 0) { | |
| haTimes +="ha"; | |
| times --; | |
| } |
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: Cry (5-5) | |
| */ | |
| // your code goes here |
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: Inline Functions (5-6) | |
| */ | |
| // don't change this code | |
| function emotions(myString, myFunc) { | |
| console.log("I am " + myString + ", " + laugh(2)); | |
| } | |
| // your code goes here |
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: Another Type of Loop (6-8) | |
| * | |
| * Use the existing `test` variable and write a `forEach` loop | |
| * that adds 100 to each number that is divisible by 3. | |
| * | |
| * Things to note: | |
| * - you must use an `if` statement to verify code is divisible by 3 | |
| * - you can use `console.log` to verify the `test` variable when you're finished looping | |
| */ |
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: I Got Bills (6-9) | |
| * | |
| * Use the .map() method to take the bills array below and create a second array | |
| * of numbers called totals. The totals array should contains each amount from the | |
| * bills array but with a 15% tip added. Log the totals array to the console. | |
| * | |
| * For example, the first two entries in the totals array would be: | |
| * | |
| * [57.76, 21.99, ... ] |
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: Nested Numbers (6-10) | |
| * | |
| * - The `numbers` variable is an array of arrays. | |
| * - Use a nested `for` loop to cycle through `numbers`. | |
| * - Convert each even number to the string "even" | |
| * - Convert each odd number to the string "odd" | |
| */ | |
| var numbers = [ |
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: Umbrella (7-1) | |
| */ | |
| var umbrella = { | |
| color: "pink", | |
| isOpen: true, | |
| open: function() { | |
| if (umbrella.isOpen === true) { | |
| return "The umbrella is already opened!"; |
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: Bank Accounts 1 (7-3) | |
| */ | |
| var savingsAccount = { | |
| balance: 1000, | |
| interestRatePercent: 1, | |
| deposit: function addMoney(amount) { | |
| if (amount > 0) { | |
| savingsAccount.balance += amount; |