Quiz: Hoisting

This lesson will test your understanding of hoisting in JavaScript.

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.