Skip to content

Instantly share code, notes, and snippets.

View claudiainbytes's full-sized avatar
😺
I build awesome digital stuff

Claudia Estupiñán Forero claudiainbytes

😺
I build awesome digital stuff
View GitHub Profile
/*
* 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 ) {
/*
* 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);
/*
* 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
/*
* 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;
/*
* 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 += "* ";
}
/*
* Programming Quiz: Laugh (5-4)
*/
var laugh = function(num){
var x = 1;
var output = "";
while ( x <= num ){
output += "ha";
x++;
var cry = function x(){
return "boohoo!";
};
console.log(cry());
// 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";
/*
* Programming Quiz: Colors of the Rainbow (6-4)
*/
var rainbow = ["Red", "Orange", "Blackberry", "Blue"];
rainbow.splice( 2, 1, "Yellow", "Green");
rainbow.push("Purple");
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));