Skip to content

Commit 7d6f778

Browse files
authored
Update js codes.docx
1 parent 8f1ce4e commit 7d6f778

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎js codes.docx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,7 @@ Hoisting:
18411841
6. Due to the concept of hoisting in JavaScript, we can call a function even before we define the function definition in our program's code.
18421842
7. Variables defined with let and const are hoisted to the top of the block, but not initialized.Let and const are also hoisted but we cant access them
18431843
until they are assigned because they are in Temporal dead zone.To avoid Temporal deadzone we need to declare let and const to the top of our program!
1844+
***when const gets hoisted it will be defined undefined,and further processing will get assigned the value , this violated the meaning of const , this is the fundamental reason why const doesn't get hoisted and let just got tagged along with this feature.
18441845

18451846
Examples:
18461847
1. Hoisting Function: If i write below code then JS compiler auto move declaration first then call of a function.

0 commit comments

Comments
 (0)