DEV Community

loading...
Cover image for Things you did not know about hoisting in Javascript!

Things you did not know about hoisting in Javascript!

comscience profile image kapeel kokane ・1 min read

So you think you know javascript, right?

What do you think would be the output of this code snippet?

Question 1

it's 2

Stumped yet?

What about this question? What do you think is the output this time?

Alt Text

its undefined

Confused? Well, let us clear that confusion. Here's a short video that I created concisely explaining the concept:
https://www.youtube.com/watch?v=ncq_PE3T0WI&t=18s

Discussion (0)

Forem Open with the Forem app