Search⌘ K

Quiz: Hoisting

Explore key JavaScript concepts through a hoisting quiz designed to deepen your grasp of language basics like scope and variable behavior. This practice helps prepare you for technical interviews by reinforcing essential knowledge.

We'll cover the following...

Question 1 #

Technical Quiz
1.

Study the code below:

function Add(){
    console.log(answer)
    var answer = 2
};
Add()

What will be the output of the following code?

A.

2

B.

4

C.

undefined

D.

Error


1 / 1

Question 2 #

Technical Quiz
1.

Study the code below:

var temp= 'hi';
function display(){
    console.log(temp);
    var temp = 'bye';
};
display();

What will be the output of the code?

A.

hi

B.

bye

C.

undefined

D.

Error


1 / 1

Let’s discuss the answers in the next lesson.