Skip to content

Instantly share code, notes, and snippets.

@leecameron
leecameron / laugh-it-off-2
Created December 7, 2017 22:38
Google scholarship, JavaScript, functions, laugh it off 2 quiz
/*
* 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) {
@leecameron
leecameron / laugh-it-off-1
Last active December 6, 2017 19:45
Google scholarship, JavaScript, functions, laugh it off 1 quiz
/*
* Programming Quiz: Laugh it Off 1 (5-1)
*/
// your code goes here
function laugh() {
var sound = "hahahahahahahahahaha!";
return sound;
}
console.log (laugh());
@leecameron
leecameron / find-my-seat
Created December 5, 2017 22:44
Google scholarship, JavaScript, loops, find my seat quiz
/*
* 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
@leecameron
leecameron / factorials
Created December 5, 2017 16:07
Google scholarship, JavaScript, loops, factorials quiz
/*
* Programming Quiz: Factorials (4-7)
*/
// your code goes here
var solution = 1;
for (var x = 12; x > 0; x--) {
solution *= x;
}
console.log(solution);
@leecameron
leecameron / fixing-error-2
Created December 5, 2017 14:08
Google scholarship, JavaScript, loops, fixing error 2 quiz
/*
* Programming Quiz: Fix the Error 2 (4-6)
*/
// fix the for loop
for (var k = 0; k < 200; k++) {
console.log(k);
}
@leecameron
leecameron / fix-error-1
Created December 5, 2017 14:06
Google scholarship, JavaScript, loops, fix error 1 quiz
/*
* Programming Quiz: Fix the Error 1 (4-5)
*/
// fix the for loop
for (var x = 5; x < 10; x++) {
console.log(x);
}
@leecameron
leecameron / changing-the-loop
Created December 5, 2017 13:49
Google scholarship, JavaScript, loops, changing the loop quiz
/*
* Programming Quiz: Changing the Loop (4-4)
*/
// rewrite the while loop as a for loop
/*var x = 9;
*while (x >= 1) {
* console.log("hello " + x);
* x = x - 1;
*}
@leecameron
leecameron / countdown
Created December 4, 2017 23:07
Google scholarship, JavaScript, Loops, countdown quiz
*/
// your code goes here
var x = 60;
while (x >= 0)
{
if (x === 50) {
console.log("Orbiter transfers from ground to internal power");
@leecameron
leecameron / 99-bottles-of-juice
Created December 4, 2017 12:04
Google scholarship, JavaScript, Loops, 99 bottles of juice quiz
/*
* 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".
*/
@leecameron
leecameron / murder-mystery
Created December 4, 2017 09:53
Google scholarship, JavaScript, conditionals, murder mystery quiz
/*
* Programming Quiz: Murder Mystery (3-4)
*/
// change the value of `room` and `suspect` to test your code
var room = "ballroom";
var suspect = "Mr. Kalehoff";
var weapon = "";
var solved = false;