Your question is Hoisting and Console Output. Take a moment with it on the right.
Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).
SugarAI's frontend team opens interviews with a short hoisting exercise. Read exactly what's written below.
console.log(typeof getUser);
console.log(user);
var user = "loading";
function getUser() {
return "Ada";
}
console.log(count);
let count = 5;
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log("var i:", i), 0);
}
for (let j = 0; j < 3; j++) {
setTimeout(() => console.log("let j:", j), 0);
}
Explain the concept of hoisting, then give the exact console output for this script, line by line, in the order it is actually printed, including whatever happens with the two setTimeout loops.