Skip to content

OutputNot attempted

Same as ho-1 without the let

console.log(typeof a, typeof c, typeof d);
var a = 1;
function c() {}

Spaces and quote style don’t matter · write a thrown error as TypeError

Ctrl Enter
Show answer & explanation

The expected output comes from actually running the snippet; opening this shows it next to the explanation.

var is hoisted and initialised to undefined; function declarations are hoisted with their body; undeclared d is safe with typeof.