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: 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: 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: 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: 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(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
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
// 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
/* | |
* Programming Quiz: Colors of the Rainbow (6-4) | |
*/ | |
var rainbow = ["Red", "Orange", "Blackberry", "Blue"]; | |
rainbow.splice( 2, 1, "Yellow", "Green"); | |
rainbow.push("Purple"); |
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
function hasEnoughPlayers(team){ | |
return (team.length >= 7) ? true : false; | |
} | |
var team = ["Oliver Wood", "Angelina Johnson", "Katie Bell", "Alicia Spinnet", "George Weasley", "Fred Weasley", "Harry Potter"]; | |
console.log(hasEnoughPlayers(team)); |