Skip to content

Instantly share code, notes, and snippets.

View claudiainbytes's full-sized avatar

Claudia Estupiñán Forero claudiainbytes

View GitHub Profile
// 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";
var cry = function x(){
return "boohoo!";
};
console.log(cry());
/*
* Programming Quiz: Laugh (5-4)
*/
var laugh = function(num){
var x = 1;
var output = "";
while ( x <= num ){
output += "ha";
x++;
/*
* 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 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: 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: 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: 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: 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".
*/
/*
* Programming Quiz: JuliaJames (4-1)
*/
var x = 1;
while ( x <= 20) {
// check divisibility
if(( x % 3 === 0 ) && ( x % 5 === 0)){
console.log("JuliaJames");