codejump

Functions & Scope

Preview — 3 of 10 questions

What will the following code output?

javascript
console.log(x);
var x = 10;
Anull
B10
CReferenceError
Dundefined

Which statement is true about JavaScript hoisting?

javascript
console.log(a); // ReferenceError
let a = 5;
ABoth let and const are hoisted, but not initialized.
BOnly var declarations are hoisted.
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.