JavaScript Tutorial in Hindi for Beginners [Part 37] – Hoisting in JavaScript



JavaScript Tutorial in Hindi for Beginners [Part 37] – Hoisting in JavaScript

JavaScript Tutorial in Hindi for Beginners [Part 37] - Hoisting in JavaScript

#Javascript #Tutorial #Hindi

Link for Complete JavaScript Tutorial in Hindi for Beginners: https://www.youtube.com/playlist?list=PLjpp5kBQLNTSvHo6Rp4Ky0X8x_MabmKye

Link for Complete HTML and CSS Tutorial in Hindi for Beginners: https://www.youtube.com/playlist?list=PLjpp5kBQLNTSdLVVjU_kea8J8lP24ZseT

In this video i will talk about Hoisting in JavaScript.

Hoisting is JavaScript’s default behavior of moving declarations to the top.

JavaScript Declarations are Hoisted
In JavaScript, a variable can be declared after it has been used.

In other words; a variable can be used before it has been declared.

Hoisting is JavaScript’s default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function).

Variables defined with let and const are hoisted to the top of the block, but not initialized.

Meaning: The block of code is aware of the variable, but it cannot be used until it has been declared.

Using a let variable before it is declared will result in a ReferenceError.

Hoisting is a term you will not find used in any normative specification prose prior to ECMAScript® 2015 Language Specification. Hoisting was thought up as a general way of thinking about how execution contexts (specifically the creation and execution phases) work in JavaScript. However, the concept can be a little confusing at first.

Please subscribe to watch more videos like this: https://www.youtube.com/channel/UCWCGvAu1NDCldmLasELk62g?sub_confirmation=1

Join this channel to support Tech Gun:
https://www.youtube.com/channel/UCWCGvAu1NDCldmLasELk62g/join

Comments are closed.