[{"data":1,"prerenderedAt":1101},["ShallowReactive",2],{"blog-\u002Fblog\u002Fjavascript-variables-scope-hoisting":3},{"id":4,"title":5,"body":6,"description":1085,"difficulty":1086,"extension":1087,"framework":1088,"frameworkSlug":1089,"meta":1090,"navigation":1091,"order":157,"path":1092,"qaPath":1093,"seo":1094,"stem":1095,"subtopic":1096,"topic":1097,"topicSlug":1098,"updated":1099,"__hash__":1100},"blog\u002Fblog\u002Fjavascript-variables-scope-hoisting.md","JavaScript Variables, Scope & Hoisting — var, let & const Explained",{"type":7,"value":8,"toc":1073},"minimark",[9,14,51,55,134,144,255,270,274,303,396,402,406,424,512,532,534,541,577,658,687,691,705,744,753,757,773,877,893,897,926,956,965,969,1020,1024,1069],[10,11,13],"h2",{"id":12},"javascript-variables-scope-and-hoisting","JavaScript variables, scope, and hoisting",[15,16,17,21,22,25,26,29,30,21,34,25,37,40,41,44,45,47,48,50],"p",{},[18,19,20],"code",{},"var",", ",[18,23,24],{},"let",", and ",[18,27,28],{},"const"," look interchangeable until they aren't. The differences in\n",[31,32,33],"strong",{},"scope",[31,35,36],{},"hoisting",[31,38,39],{},"reassignment"," explain a long list of behaviors: why a\nvariable is ",[18,42,43],{},"undefined"," before its line, why a ",[18,46,24],{}," throws if accessed too early, and\nwhy the classic ",[18,49,20],{}," loop prints the wrong numbers. This guide ties it all together.",[10,52,54],{"id":53},"var-let-and-const","var, let, and const",[56,57,58,80],"table",{},[59,60,61],"thead",{},[62,63,64,68,71,74,77],"tr",{},[65,66,67],"th",{},"Keyword",[65,69,70],{},"Scope",[65,72,73],{},"Hoisting",[65,75,76],{},"Reassignable",[65,78,79],{},"Redeclarable",[81,82,83,103,120],"tbody",{},[62,84,85,90,93,98,101],{},[86,87,88],"td",{},[18,89,20],{},[86,91,92],{},"function",[86,94,95,96],{},"yes, init ",[18,97,43],{},[86,99,100],{},"yes",[86,102,100],{},[62,104,105,109,112,115,117],{},[86,106,107],{},[18,108,24],{},[86,110,111],{},"block",[86,113,114],{},"yes, in TDZ",[86,116,100],{},[86,118,119],{},"no",[62,121,122,126,128,130,132],{},[86,123,124],{},[18,125,28],{},[86,127,111],{},[86,129,114],{},[86,131,119],{},[86,133,119],{},[15,135,136,137,139,140,143],{},"The subtle one is ",[18,138,28],{},": it makes the ",[31,141,142],{},"binding"," constant, not the value. You can't\nreassign the variable, but you can mutate the object or array it points to.",[145,146,151],"pre",{"className":147,"code":148,"language":149,"meta":150,"style":150},"language-js shiki shiki-themes github-light github-dark","const user = { name: 'Ada' }\nuser.name = 'Grace' \u002F\u002F mutating the object\nuser = {}           \u002F\u002F TypeError — reassigning the binding\nconst list = [1, 2]\nlist.push(3)        \u002F\u002F [1, 2, 3]\n","js","",[18,152,153,179,195,209,233],{"__ignoreMap":150},[154,155,158,161,165,168,172,176],"span",{"class":156,"line":157},"line",1,[154,159,28],{"class":160},"szBVR",[154,162,164],{"class":163},"sj4cs"," user",[154,166,167],{"class":160}," =",[154,169,171],{"class":170},"sVt8B"," { name: ",[154,173,175],{"class":174},"sZZnC","'Ada'",[154,177,178],{"class":170}," }\n",[154,180,182,185,188,191],{"class":156,"line":181},2,[154,183,184],{"class":170},"user.name ",[154,186,187],{"class":160},"=",[154,189,190],{"class":174}," 'Grace'",[154,192,194],{"class":193},"sJ8bj"," \u002F\u002F mutating the object\n",[154,196,198,201,203,206],{"class":156,"line":197},3,[154,199,200],{"class":170},"user ",[154,202,187],{"class":160},[154,204,205],{"class":170}," {}           ",[154,207,208],{"class":193},"\u002F\u002F TypeError — reassigning the binding\n",[154,210,212,214,217,219,222,225,227,230],{"class":156,"line":211},4,[154,213,28],{"class":160},[154,215,216],{"class":163}," list",[154,218,167],{"class":160},[154,220,221],{"class":170}," [",[154,223,224],{"class":163},"1",[154,226,21],{"class":170},[154,228,229],{"class":163},"2",[154,231,232],{"class":170},"]\n",[154,234,236,239,243,246,249,252],{"class":156,"line":235},5,[154,237,238],{"class":170},"list.",[154,240,242],{"class":241},"sScJk","push",[154,244,245],{"class":170},"(",[154,247,248],{"class":163},"3",[154,250,251],{"class":170},")        ",[154,253,254],{"class":193},"\u002F\u002F [1, 2, 3]\n",[15,256,257,258,263,264,266,267,269],{},"Modern guidance: ",[31,259,260,261],{},"default to ",[18,262,28],{},", use ",[18,265,24],{}," only when you must reassign, and\navoid ",[18,268,20],{},".",[10,271,273],{"id":272},"scope-function-vs-block","Scope: function vs block",[15,275,276,279,280,282,283,279,286,288,289,291,292,295,296,21,299,302],{},[31,277,278],{},"Function scope"," (",[18,281,20],{},") makes a variable visible anywhere in the enclosing function,\nregardless of nested blocks. ",[31,284,285],{},"Block scope",[18,287,24],{},"\u002F",[18,290,28],{},") confines it to the nearest\n",[18,293,294],{},"{ }"," — including ",[18,297,298],{},"if",[18,300,301],{},"for",", and bare blocks.",[145,304,306],{"className":147,"code":305,"language":149,"meta":150,"style":150},"function demo() {\n  if (true) {\n    var v = 'function-scoped'\n    let l = 'block-scoped'\n  }\n  console.log(v) \u002F\u002F 'function-scoped' — var leaks out of the if\n  console.log(l) \u002F\u002F ReferenceError — l only exists inside the if\n}\n",[18,307,308,318,331,344,357,362,377,390],{"__ignoreMap":150},[154,309,310,312,315],{"class":156,"line":157},[154,311,92],{"class":160},[154,313,314],{"class":241}," demo",[154,316,317],{"class":170},"() {\n",[154,319,320,323,325,328],{"class":156,"line":181},[154,321,322],{"class":160},"  if",[154,324,279],{"class":170},[154,326,327],{"class":163},"true",[154,329,330],{"class":170},") {\n",[154,332,333,336,339,341],{"class":156,"line":197},[154,334,335],{"class":160},"    var",[154,337,338],{"class":170}," v ",[154,340,187],{"class":160},[154,342,343],{"class":174}," 'function-scoped'\n",[154,345,346,349,352,354],{"class":156,"line":211},[154,347,348],{"class":160},"    let",[154,350,351],{"class":170}," l ",[154,353,187],{"class":160},[154,355,356],{"class":174}," 'block-scoped'\n",[154,358,359],{"class":156,"line":235},[154,360,361],{"class":170},"  }\n",[154,363,365,368,371,374],{"class":156,"line":364},6,[154,366,367],{"class":170},"  console.",[154,369,370],{"class":241},"log",[154,372,373],{"class":170},"(v) ",[154,375,376],{"class":193},"\u002F\u002F 'function-scoped' — var leaks out of the if\n",[154,378,380,382,384,387],{"class":156,"line":379},7,[154,381,367],{"class":170},[154,383,370],{"class":241},[154,385,386],{"class":170},"(l) ",[154,388,389],{"class":193},"\u002F\u002F ReferenceError — l only exists inside the if\n",[154,391,393],{"class":156,"line":392},8,[154,394,395],{"class":170},"}\n",[15,397,398,399,401],{},"This leakage is a primary reason to avoid ",[18,400,20],{},": block scoping keeps variables where\nthey're relevant.",[10,403,405],{"id":404},"lexical-scope-and-the-scope-chain","Lexical scope and the scope chain",[15,407,408,409,412,413,416,417,420,421,269],{},"JavaScript uses ",[31,410,411],{},"lexical (static) scope"," — a variable's accessibility is determined by\n",[31,414,415],{},"where it's written",", not where it's called. Variable lookup walks the ",[31,418,419],{},"scope chain","\noutward (current -> enclosing -> … -> global), and the first match wins; no match is a\n",[18,422,423],{},"ReferenceError",[145,425,427],{"className":147,"code":426,"language":149,"meta":150,"style":150},"const a = 'global'\nfunction outer() {\n  const b = 'outer'\n  function inner() { return `${a} ${b}` } \u002F\u002F reaches outward\n  return inner()\n}\n",[18,428,429,441,450,463,498,508],{"__ignoreMap":150},[154,430,431,433,436,438],{"class":156,"line":157},[154,432,28],{"class":160},[154,434,435],{"class":163}," a",[154,437,167],{"class":160},[154,439,440],{"class":174}," 'global'\n",[154,442,443,445,448],{"class":156,"line":181},[154,444,92],{"class":160},[154,446,447],{"class":241}," outer",[154,449,317],{"class":170},[154,451,452,455,458,460],{"class":156,"line":197},[154,453,454],{"class":160},"  const",[154,456,457],{"class":163}," b",[154,459,167],{"class":160},[154,461,462],{"class":174}," 'outer'\n",[154,464,465,468,471,474,477,480,483,486,489,492,495],{"class":156,"line":211},[154,466,467],{"class":160},"  function",[154,469,470],{"class":241}," inner",[154,472,473],{"class":170},"() { ",[154,475,476],{"class":160},"return",[154,478,479],{"class":174}," `${",[154,481,482],{"class":170},"a",[154,484,485],{"class":174},"} ${",[154,487,488],{"class":170},"b",[154,490,491],{"class":174},"}`",[154,493,494],{"class":170}," } ",[154,496,497],{"class":193},"\u002F\u002F reaches outward\n",[154,499,500,503,505],{"class":156,"line":235},[154,501,502],{"class":160},"  return",[154,504,470],{"class":241},[154,506,507],{"class":170},"()\n",[154,509,510],{"class":156,"line":364},[154,511,395],{"class":170},[15,513,514,515,518,519,523,524,288,526,528,529,269],{},"Inner scopes see outer variables, never the reverse. (This is exactly what closures\npreserve.) ",[31,516,517],{},"Shadowing"," — declaring a same-named variable in an inner scope — is legal\nand creates a separate binding; redeclaring in the ",[520,521,522],"em",{},"same"," scope with ",[18,525,24],{},[18,527,28],{}," is a\n",[18,530,531],{},"SyntaxError",[10,533,73],{"id":36},[15,535,536,537,540],{},"Hoisting is the engine processing ",[31,538,539],{},"declarations"," before executing code, so they behave\nas if moved to the top of their scope. What gets hoisted differs:",[542,543,544,556,566],"ul",{},[545,546,547,549,550,555],"li",{},[18,548,20],{}," — hoisted and ",[31,551,552,553],{},"initialized to ",[18,554,43],{}," (readable, just empty).",[545,557,558,561,562,565],{},[31,559,560],{},"Function declarations"," — hoisted ",[31,563,564],{},"entirely"," (callable before their line).",[545,567,568,288,570,572,573,576],{},[18,569,24],{},[18,571,28],{}," — hoisted but ",[31,574,575],{},"uninitialized"," (the temporal dead zone).",[145,578,580],{"className":147,"code":579,"language":149,"meta":150,"style":150},"console.log(a) \u002F\u002F undefined (var hoisted, value not yet assigned)\nvar a = 1\ngreet()        \u002F\u002F 'hi' (function declaration fully hoisted)\nfunction greet() { return 'hi' }\nconsole.log(b) \u002F\u002F ReferenceError (TDZ)\nlet b = 2\n",[18,581,582,595,607,618,634,646],{"__ignoreMap":150},[154,583,584,587,589,592],{"class":156,"line":157},[154,585,586],{"class":170},"console.",[154,588,370],{"class":241},[154,590,591],{"class":170},"(a) ",[154,593,594],{"class":193},"\u002F\u002F undefined (var hoisted, value not yet assigned)\n",[154,596,597,599,602,604],{"class":156,"line":181},[154,598,20],{"class":160},[154,600,601],{"class":170}," a ",[154,603,187],{"class":160},[154,605,606],{"class":163}," 1\n",[154,608,609,612,615],{"class":156,"line":197},[154,610,611],{"class":241},"greet",[154,613,614],{"class":170},"()        ",[154,616,617],{"class":193},"\u002F\u002F 'hi' (function declaration fully hoisted)\n",[154,619,620,622,625,627,629,632],{"class":156,"line":211},[154,621,92],{"class":160},[154,623,624],{"class":241}," greet",[154,626,473],{"class":170},[154,628,476],{"class":160},[154,630,631],{"class":174}," 'hi'",[154,633,178],{"class":170},[154,635,636,638,640,643],{"class":156,"line":235},[154,637,586],{"class":170},[154,639,370],{"class":241},[154,641,642],{"class":170},"(b) ",[154,644,645],{"class":193},"\u002F\u002F ReferenceError (TDZ)\n",[154,647,648,650,653,655],{"class":156,"line":364},[154,649,24],{"class":160},[154,651,652],{"class":170}," b ",[154,654,187],{"class":160},[154,656,657],{"class":163}," 2\n",[15,659,660,661,664,665,667,668,21,670,288,672,674,675,678,679,682,683,686],{},"Mental model: it's two phases. A ",[31,662,663],{},"creation phase"," registers all declarations\n(",[18,666,20],{},"->",[18,669,43],{},[18,671,24],{},[18,673,28],{},"->uninitialized, functions->fully defined); an\n",[31,676,677],{},"execution phase"," runs the code and performs assignments in place. Nothing physically\nmoves — only assignments happen where you wrote them. Function ",[31,680,681],{},"expressions"," (and\narrows) follow normal variable hoisting, so they're ",[520,684,685],{},"not"," callable before assignment.",[10,688,690],{"id":689},"the-temporal-dead-zone","The temporal dead zone",[15,692,693,694,288,696,698,699,701,702,269],{},"The TDZ is the window between entering a scope and the line where a ",[18,695,24],{},[18,697,28],{}," is\ndeclared. The binding exists but is uninitialized, so any access throws a\n",[18,700,423],{}," — even ",[18,703,704],{},"typeof",[145,706,708],{"className":147,"code":707,"language":149,"meta":150,"style":150},"{\n  console.log(x) \u002F\u002F ReferenceError: Cannot access 'x' before initialization\n  let x = 5\n}\n",[18,709,710,715,727,740],{"__ignoreMap":150},[154,711,712],{"class":156,"line":157},[154,713,714],{"class":170},"{\n",[154,716,717,719,721,724],{"class":156,"line":181},[154,718,367],{"class":170},[154,720,370],{"class":241},[154,722,723],{"class":170},"(x) ",[154,725,726],{"class":193},"\u002F\u002F ReferenceError: Cannot access 'x' before initialization\n",[154,728,729,732,735,737],{"class":156,"line":197},[154,730,731],{"class":160},"  let",[154,733,734],{"class":170}," x ",[154,736,187],{"class":160},[154,738,739],{"class":163}," 5\n",[154,741,742],{"class":156,"line":211},[154,743,395],{"class":170},[15,745,746,747,749,750,752],{},"It exists on purpose: it turns \"used before declared\" from a silent ",[18,748,43],{}," bug (the\n",[18,751,20],{}," behavior) into a loud, immediate error. Class declarations are also hoisted into a\nTDZ, so they can't be used before their line either.",[10,754,756],{"id":755},"the-loop-closure-bug","The loop closure bug",[15,758,759,760,762,763,766,767,769,770,269],{},"The most famous scope question. With ",[18,761,20],{},", the loop reuses ",[31,764,765],{},"one"," function-scoped\nbinding, so deferred callbacks all read its final value. ",[18,768,24],{}," creates a ",[31,771,772],{},"fresh binding\nper iteration",[145,774,776],{"className":147,"code":775,"language":149,"meta":150,"style":150},"for (var i = 0; i \u003C 3; i++) setTimeout(() => console.log(i)) \u002F\u002F 3 3 3\nfor (let j = 0; j \u003C 3; j++) setTimeout(() => console.log(j)) \u002F\u002F 0 1 2\n",[18,777,778,832],{"__ignoreMap":150},[154,779,780,782,784,786,789,791,794,797,800,803,806,809,812,815,818,821,824,826,829],{"class":156,"line":157},[154,781,301],{"class":160},[154,783,279],{"class":170},[154,785,20],{"class":160},[154,787,788],{"class":170}," i ",[154,790,187],{"class":160},[154,792,793],{"class":163}," 0",[154,795,796],{"class":170},"; i ",[154,798,799],{"class":160},"\u003C",[154,801,802],{"class":163}," 3",[154,804,805],{"class":170},"; i",[154,807,808],{"class":160},"++",[154,810,811],{"class":170},") ",[154,813,814],{"class":241},"setTimeout",[154,816,817],{"class":170},"(() ",[154,819,820],{"class":160},"=>",[154,822,823],{"class":170}," console.",[154,825,370],{"class":241},[154,827,828],{"class":170},"(i)) ",[154,830,831],{"class":193},"\u002F\u002F 3 3 3\n",[154,833,834,836,838,840,843,845,847,850,852,854,857,859,861,863,865,867,869,871,874],{"class":156,"line":181},[154,835,301],{"class":160},[154,837,279],{"class":170},[154,839,24],{"class":160},[154,841,842],{"class":170}," j ",[154,844,187],{"class":160},[154,846,793],{"class":163},[154,848,849],{"class":170},"; j ",[154,851,799],{"class":160},[154,853,802],{"class":163},[154,855,856],{"class":170},"; j",[154,858,808],{"class":160},[154,860,811],{"class":170},[154,862,814],{"class":241},[154,864,817],{"class":170},[154,866,820],{"class":160},[154,868,823],{"class":170},[154,870,370],{"class":241},[154,872,873],{"class":170},"(j)) ",[154,875,876],{"class":193},"\u002F\u002F 0 1 2\n",[15,878,879,880,882,883,886,887,889,890,892],{},"By the time the timers fire, the ",[18,881,20],{}," loop has finished and ",[18,884,885],{},"i"," is ",[18,888,248],{},". ",[18,891,24],{}," re-binds\nper iteration. The pre-ES6 fix was an IIFE to manufacture a new scope each pass.",[10,894,896],{"id":895},"strict-mode-modules-and-globals","Strict mode, modules, and globals",[15,898,899,900,902,903,906,907,288,909,911,912,279,915,918,919,922,923,925],{},"At the top level of a classic script, ",[18,901,20],{}," creates a property on the global object\n(",[18,904,905],{},"window.x","); ",[18,908,24],{},[18,910,28],{}," do not. ",[31,913,914],{},"Assigning without declaring",[18,916,917],{},"x = 5",") in sloppy\nmode creates an accidental global — ",[31,920,921],{},"strict mode"," throws a ",[18,924,423],{}," instead.",[145,927,929],{"className":147,"code":928,"language":149,"meta":150,"style":150},"'use strict'\nfunction f() { count = 1 } \u002F\u002F ReferenceError (no var\u002Flet\u002Fconst)\n",[18,930,931,936],{"__ignoreMap":150},[154,932,933],{"class":156,"line":157},[154,934,935],{"class":174},"'use strict'\n",[154,937,938,940,943,946,948,951,953],{"class":156,"line":181},[154,939,92],{"class":160},[154,941,942],{"class":241}," f",[154,944,945],{"class":170},"() { count ",[154,947,187],{"class":160},[154,949,950],{"class":163}," 1",[154,952,494],{"class":170},[154,954,955],{"class":193},"\u002F\u002F ReferenceError (no var\u002Flet\u002Fconst)\n",[15,957,958,961,962,964],{},[31,959,960],{},"ES modules"," have their own top-level scope and are always strict, so even top-level\n",[18,963,20],{}," doesn't pollute the global object — a big improvement over scripts. Minimize\nglobals: they create hidden coupling and name collisions. When you truly need one,\nnamespace it under a single object.",[10,966,968],{"id":967},"common-pitfalls","Common pitfalls",[542,970,971,994,1008],{},[545,972,973,601,982,984,985,987,988,991,992,269],{},[31,974,975,978,979,981],{},[18,976,977],{},"switch"," and ",[18,980,24],{},":",[18,983,977],{}," is one block scope, so a ",[18,986,24],{}," in one ",[18,989,990],{},"case"," is in\nthe TDZ for the whole switch — wrap each case body in ",[18,993,294],{},[545,995,996,279,1001,1004,1005,1007],{},[31,997,998,1000],{},[18,999,28],{}," requires initialization",[18,1002,1003],{},"const x;"," is a ",[18,1006,531],{},").",[545,1009,1010,1015,1016,1019],{},[31,1011,1012,1014],{},[18,1013,28],{}," arrays\u002Fobjects are still mutable"," — freeze with ",[18,1017,1018],{},"Object.freeze"," (shallow)\nif you need immutable contents.",[10,1021,1023],{"id":1022},"recap","Recap",[15,1025,1026,1027,978,1029,1032,1033,1035,1036,1038,1039,889,1041,1043,1044,1047,1048,1050,1051,1053,1054,1056,1057,1059,1060,288,1062,1064,1065,1068],{},"Choose variables by ",[31,1028,33],{},[31,1030,1031],{},"mutability",": ",[18,1034,28],{}," by default, ",[18,1037,24],{}," when you\nreassign, never ",[18,1040,20],{},[31,1042,285],{}," keeps variables contained; ",[31,1045,1046],{},"lexical scope"," and\nthe ",[31,1049,419],{}," determine what's visible. ",[31,1052,73],{}," registers declarations before\nexecution — ",[18,1055,20],{}," becomes ",[18,1058,43],{},", functions become callable, and ",[18,1061,24],{},[18,1063,28],{}," sit\nin the ",[31,1066,1067],{},"temporal dead zone"," until declared, which catches use-before-declaration bugs.\nUnderstand binding-per-iteration and the loop bug disappears; prefer modules and strict\nmode and accidental globals disappear too.",[1070,1071,1072],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":150,"searchDepth":181,"depth":181,"links":1074},[1075,1076,1077,1078,1079,1080,1081,1082,1083,1084],{"id":12,"depth":181,"text":13},{"id":53,"depth":181,"text":54},{"id":272,"depth":181,"text":273},{"id":404,"depth":181,"text":405},{"id":36,"depth":181,"text":73},{"id":689,"depth":181,"text":690},{"id":755,"depth":181,"text":756},{"id":895,"depth":181,"text":896},{"id":967,"depth":181,"text":968},{"id":1022,"depth":181,"text":1023},"Common JavaScript interview questions on var, let and const, scope, hoisting and the temporal dead zone, with clear answers and examples.","easy","md","JavaScript","javascript",{},true,"\u002Fblog\u002Fjavascript-variables-scope-hoisting","\u002Fjavascript\u002Ffundamentals\u002Fvariables-scope-hoisting",{"title":5,"description":1085},"blog\u002Fjavascript-variables-scope-hoisting","Variables, Scope & Hoisting","Fundamentals","fundamentals","2026-06-17","oBMWrzaFUvDEbpM2nzprS6nlGrTSoMTEOqN6ZzIbDWo",1781808673080]