EduFlow
JavaScript Fundamentals

Checkpoint: Logic and Functions

Five questions on this section. Answer all of them, then see your score and why each answer is right or wrong.

Question 1 of 5

What does this log?

JavaScript
function sizeLabel(amount) {
  if (amount > 100) return "big";
  if (amount > 1000) return "huge";
  return "small";
}
console.log(sizeLabel(5000));
Question 2 of 5

A function shows “No note” when if (note) is false. Which of these notes is treated as missing?

Question 3 of 5

What does this log?

JavaScript
let count = 0;
for (let i = 0; i < 5; i++) {
  if (i === 3) break;
  count++;
}
console.log(count);
Question 4 of 5

What does this log?

JavaScript
const add = (a, b = 10) => a + b;
console.log(add(5), add(5, 0), add(5, null));
Question 5 of 5

What does this log?

JavaScript
function makeLimiter(max) {
  let used = 0;
  return () => {
    if (used >= max) return false;
    used++;
    return true;
  };
}
const canAdd = makeLimiter(2);
console.log(canAdd(), canAdd(), canAdd());

5 questions unanswered