logoalt Hacker News

jauntywundrkindtoday at 4:14 AM1 replyview on HN

Afaik let in JavaScript also has a sizable penalty too, if not quite as bad as const. Var on and on.


Replies

crabmuskettoday at 4:28 AM

Let and const have a "temporal dead zone" before initialisation that distinguishes them from var, which is just undefined:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Runtime TDZ checks can be performance issues:

https://vincentrolfs.dev/blog/ts-var