What is hoisting in JavaScript? What is the difference between undefined and not defined?

What is hoisting?

Hoisting is the ability to access variables and functions even before initializing them.

When we get Reference Error as Not Defined?

Ex: console.log(x)

Have you wondered what is the shortest JavaScript Program?

This is an empty JavaScript file(index.js) because in every file execution context is created and it sets up memory space.

Introduction to this keyword

Whenever you create an execution context, a “this” is also created along with it. This is applicable for functional and global execution contexts. At a global level, “this” points to the global object “window” in the case of the browser.

In the global space window. a , this. a and a refer to the same value.

If you wish to see the video from where I got to know these concepts, you can check it on this video link in the Namaste JavaScript series by Akshay Sir.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shubhada Beldar

Shubhada Beldar

I am a Software Engineer working in the domain of full stack web development .I love to share my thoughts, ideas and experiences with others through blogs!!!