News for hackers. Stuff that matters.
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by dalmo3 on Friday February 17, 2023 @12:18AM (#34831083)
I don't trust someone that uses let where you should be using const.
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by justinpombrio on Friday February 17, 2023 @12:30AM (#34831149)
`const` prevents surface-level mutation (though you can still modify the parts of the thing). `let` has sane scoping rules. Sadly neither has both: `let` is fully mutable and `const` has crazy scoping rules. So using `const` over `let` isn't a strict improvement.
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by dalmo3 on Friday February 17, 2023 @12:41AM (#34831225)
That's new to me. What's crazy about the scope of const?
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by justinpombrio on Friday February 17, 2023 @01:26PM (#34838398)
Wow, I just completely misremembered that. Sorry!
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by MisterKent on Friday February 17, 2023 @12:37AM (#34831189)
Source? Their scoping rules should be exactly identical....
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by seniorsassycat on Friday February 17, 2023 @01:25AM (#34831496)
Let and const have the same scope, var is the one with weird rules
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by e12e on Friday February 17, 2023 @12:53AM (#34831294)
I see many uses of const, and a few let's - which ones would you change to const?
Re:Simple Modern JavaScript Using JavaScript Modules and Imp... by hLineVsLineH on Friday February 17, 2023 @02:03AM (#34831704)
A better question would be­: which ones would you not change to `const`?