Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for answer to What is the difference between "let" and "var"? by John Slegers

Current License: CC BY-SA 4.0

Post Revisions

26 events
when toggle format what by license comment
Dec 28, 2022 at 17:05 history edited John Slegers CC BY-SA 4.0
added 1 character in body
S Nov 21, 2022 at 21:08 history suggested dlu CC BY-SA 4.0
Minor typos
Nov 21, 2022 at 2:09 review Suggested edits
S Nov 21, 2022 at 21:08
May 27, 2022 at 0:01 history edited John Slegers CC BY-SA 4.0
added 116 characters in body
Jun 20, 2020 at 9:12 history edited Community Bot
Commonmark migration
Oct 30, 2019 at 11:16 history rollback John Slegers
Rollback to Revision 12
Jun 24, 2019 at 2:50 history edited Jack Bashford CC BY-SA 4.0
added 8 characters in body
Apr 5, 2019 at 9:49 comment added John Slegers @KatinkaHesselink : I don't see the MDN saying any like that. As far as I can tell, they merely left out a quirk in IE11 that others have correctly documented. See also stackoverflow.com/questions/2356830/….
Apr 5, 2019 at 9:43 history edited John Slegers CC BY-SA 4.0
added 483 characters in body
Feb 6, 2019 at 12:42 comment added Katinka Hesselink Note that MDN says that IE DOES interpret let correctly. Which is it? developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
Jun 10, 2018 at 10:53 history edited John Slegers CC BY-SA 4.0
deleted 39 characters in body
Jun 10, 2018 at 10:37 history edited John Slegers CC BY-SA 4.0
added 6 characters in body
Jun 8, 2018 at 20:01 history edited georgeawg CC BY-SA 4.0
update
Apr 18, 2018 at 8:05 review Suggested edits
Apr 18, 2018 at 8:12
Mar 1, 2018 at 18:17 comment added GitaarLAB And..+1. That Kyle Simpson article you linked is an excellent read, thank you for that! It is also clear about the "temporal dead zone" aka "TDZ". One interesting thing I'd like to add: I've read on MDN that let and const were recommended to only use when you actually need their additional functionality, because enforcing/checking these extra features (like write-only const) result in 'more work' (and additional scope-nodes in the scope-tree) for the (current)engine(s) to enforce/check/verify/setup.
Mar 1, 2018 at 18:16 comment added GitaarLAB Your answer improved a lot (I thoroughly checked). Note that same link you referenced in your comment also says: "The (let) variable is in a "temporal dead zone" from the start of the block until the initialization is processed." That means that the 'identifier' (the text-string 'reserved' to point to 'something') is already reserved in the relevant scope, otherwise it would become part of the root/host/window scope. To me personally, 'hoisting' means nothing more than reserving/linking declared 'identifiers' to their relevant scope; excluding their initialization/assignment/modifyability!
Feb 26, 2018 at 23:37 comment added John Slegers @GitaarLAB : According to the Mozilla Developer Network : "In ECMAScript 2015, let bindings are not subject to Variable Hoisting, which means that let declarations do not move to the top of the current execution context." - Anyway, I made a few improvements to my answer that should clarify the difference in hoisting behavior between let and var!
Feb 26, 2018 at 23:33 history edited John Slegers CC BY-SA 3.0
added 2171 characters in body
Nov 28, 2016 at 9:30 history edited John Slegers CC BY-SA 3.0
deleted 6 characters in body
Nov 26, 2016 at 16:29 history edited Peter Mortensen CC BY-SA 3.0
Copy edited (e.g. ref. <http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645>), etc.
May 23, 2016 at 7:24 history edited John Slegers CC BY-SA 3.0
deleted 2 characters in body
May 21, 2016 at 4:41 comment added GitaarLAB regarding answer v4: i IS known everywhere in the function-block! It starts as undefined (due to hoisting) until you assign a value! ps: let is also hoisted (to the top of it's containing block), but will give a ReferenceError when referenced in the block before first assignment. (ps2: I'm a pro-semicolon kinda guy but you really don't need a semicolon after a block ). That being said, thanks for adding the reality-check regarding support!
Apr 8, 2016 at 13:06 history edited John Slegers CC BY-SA 3.0
added 2 characters in body
Feb 25, 2016 at 15:22 history edited John Slegers CC BY-SA 3.0
added 139 characters in body
Feb 23, 2016 at 19:01 history edited John Slegers CC BY-SA 3.0
added 190 characters in body
Feb 23, 2016 at 18:35 history answered John Slegers CC BY-SA 3.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /