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
| // don't change this code | |
| function emotions(myString, myFunc) { | |
| console.log("I am " + myString + ", " + myFunc(2)); | |
| } | |
| emotions("happy", function (num){ | |
| var x = 1; | |
| var output = ""; | |
| while ( x <= num ){ | |
| output += "ha"; |
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
| var cry = function x(){ | |
| return "boohoo!"; | |
| }; | |
| console.log(cry()); |
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(num){ | |
| var x = 1; | |
| var output = ""; | |
| while ( x <= num ){ | |
| output += "ha"; | |
| 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: 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 it Off 2 (5-2) | |
| */ | |
| // declare your function | |
| // then, call it! | |
| // print the output with console.log | |
| function laugh(num){ | |
| var 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
| /* | |
| * 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) | |
| */ | |
| var solution = 1; | |
| // your code goes here | |
| for (var x = 1; x <= 12; x++) { | |
| solution = 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: Countdown, Liftoff! (4-3) | |
| * | |
| * Using a while loop, print out the countdown output above. | |
| */ | |
| // your code goes here | |
| var seconds = 60; | |
| while ( seconds > -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
| /* | |
| * 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: JuliaJames (4-1) | |
| */ | |
| var x = 1; | |
| while ( x <= 20) { | |
| // check divisibility | |
| if(( x % 3 === 0 ) && ( x % 5 === 0)){ | |
| console.log("JuliaJames"); |