Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions AnaMunozSolution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// 1. GET EVEN

for(var i = 0; i <202; i+=2) { // will add plus 2
console.log(i)
}


// // 2. Excited Kitten
// PART 1
for(var i = 1; i<=10; i++) {
console.log('Love me, pet me! HSSSSSS!')
}

//PART 2

//array
kittens = ['human why you take pictures','the catnip made me do it', 'meow?', 'why does the red dot always get away']
// function loop every even pull and array at random
for (var i = 1; i <= 10; i++) {
console.log('Love me, pet me! HSSSSSS!')
if (i % 2 === 0) {
let randomChoice = Math.floor(Math.random()*4) // will iterate in all 4 strings in array... any higher will get undefined lower will will not pull all 3
console.log(kittens[randomChoice])//why is randomChoice in []
}
}

//3 Thermostat

currentTemp = Math.floor(Math.random()*101);
const desiredTemp = 78; // PG&E say this is the more efficient! :)

console.log('The current temperature is', desiredTemp +'F')
while (currentTemp < desiredTemp) {
currentTemp++;
console.log('The temp is now', + currentTemp + 'F');
}
while (currentTemp > desiredTemp) {
currentTemp--;
console.log('The temp is lower', + currentTemp + 'F');
}


// 4 FIZZ BUZZ

for (var i = 1; i<100; i++){
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz")
} else if ( i % 3 ===0) {
console.log("Fizz")
} else if (i % 5 === 0) {
console.log("Buzz")
} else {
console.log(i)
}
}

//BONUS

var phoneBook = {
"Abe": "111-111-1111",
"Bob": "222-222-2222",
"Cam": "333-333-3333",
"Dan": "444-444-4444",
"Ern": "555-555-5555",
"Fry": "111-111-1111",
"Gil": "222-222-2222",
"Hal": "333-333-3333",
"Ike": "444-444-4444",
"Jim": "555-555-5555",
"Kip": "111-111-1111",
"Liv": "222-222-2222",
"Mia": "333-333-3333",
"Nik": "444-444-4444",
"Oli": "555-555-5555",
"Pam": "111-111-1111",
"Qiq": "222-222-2222",
"Rob": "333-333-3333",
"Stu": "444-444-4444",
"Tad": "555-555-5555",
"Uwe": "111-111-1111",
"Val": "222-222-2222",
"Wil": "333-333-3333",
"Xiu": "444-444-4444",
"Yam": "555-555-5555",
"Zed": "111-111-1111"
}

for (var person in phoneBook) {
if(phoneBook[person] === "333-333-3333"){
console.log(person)}
}