// Practice Set · JS Scope · guest

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

Question 1 of 5 from: JS Scope

What does this log?

function visit() {
  let count = 0;
  count++;
  return count;
}
visit();
visit();
console.log(visit());
Question 2 of 5 from: JS Scope

What does this log?

function makeCounter() {
  let n = 0;
  return () => ++n;
}
const a = makeCounter();
const b = makeCounter();
a();
a();
console.log(a(), b());
Question 3 of 5 from: JS var/let/const

Which statement about declaring the same name twice in one scope is true?

Question 4 of 5 from: JS Strict Mode

What happens when this runs?

"use strict";
const settings = Object.freeze({ theme: "dark" });
settings.theme = "light";
console.log(settings.theme);
Question 5 of 5 from: JS Strict Mode

Putting "use strict"; on the second line of a function, after another statement, still turns strict mode on for that function.

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.