Expert Mastery

Preview — 3 of 10 questions

What is the output of the following code?

javascript
console.log("Start");
setTimeout(() => console.log("Timeout"), 0);
Promise.resolve().then(() => console.log("Promise"));
console.log("End");
AStart → Timeout → Promise → End
BStart → End → Promise → Timeout
CStart → Promise → End → Timeout
DStart → Timeout → End → Promise

What will be logged to the console?

javascript
function createCounter() {
  let count = 0;
  return () => console.log(++count);
}

const counter1 = createCounter();
counter1();
counter1();
A1, 1
B1, 2
Cundefined, undefined
DReferenceError

What is the output?

javascript
const obj = {
  value: 10,
  getValue: () => console.log(this.value)
};

obj.getValue();
A10
Bundefined
CError
Dnull

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.