// Practice Set · JS Loops · guest

Guest practice: this set is not saved and does not count.

Question 1 of 5 from: JS Loop for

What does this log?

const pets = ["cat", "dog"];
for (const p in pets) {
  console.log(p);
}
Question 2 of 5 from: JS Loop for

What does this log?

let count = 0;
for (let a = 0; a < 3; a++) {
  for (let b = 0; b < 4; b++) {
    count++;
  }
}
console.log(count);
Question 3 of 5 from: JS Break

What does this log?

for (let row = 1; row <= 2; row++) {
  for (let col = 1; col <= 3; col++) {
    if (col === 2) break;
    console.log(row + "," + col);
  }
}
Question 4 of 5 from: JS Control Flow

What does this log?

const amounts = [5, 0, 10, -1, 20];
let total = 0;
for (const a of amounts) {
  if (a === 0) continue;
  if (a < 0) break;
  total += a;
}
console.log(total);
Question 5 of 5 from: JS Control Flow

What does this log?

function firstBig(nums) {
  for (const n of nums) {
    if (n > 10) return n;
  }
  return null;
}
console.log(firstBig([3, 12, 40]));
Ready to submit?

Click a question to go back and check it. After you submit, you will see the right answer and an explanation for every question. As a guest, nothing is saved.