Functions & Scope

Preview — 3 of 10 questions

What will the following code output?

javascript
console.log(x);
var x = 10;
Aundefined
B10
CReferenceError
Dnull

Which statement is true about JavaScript hoisting?

javascript
console.log(a); // ReferenceError
let a = 5;
AOnly var declarations are hoisted.
BBoth let and const are hoisted, but not initialized.
CFunctions are not hoisted.
DHoisting moves both declarations and initializations to the top.

What is the output of the following code?

javascript
console.log(typeof typeof 1);
A"number"
B"string"
C"undefined"
D"object"

Sign up free to play

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