Should "const" be favored over "let"?

Frankie Bagnardi f.bagnardi at gmail.com
Fri Apr 17 07:46:32 UTC 2015


I've switched to let/const completely.  The gain of using const isn't
performance (you can statically analyze whether any non-global is
potentially assigned to).  The gain from const is that it's very very easy
for a human to statically analyze.

If I see a let binding, I know I need to be a bit more careful with editing
that piece of code.

I originally thought this'd be a terrible idea, but it's been working great
for me.


On Thu, Apr 16, 2015 at 10:53 PM, Glen Huang <curvedmark at gmail.com> wrote:

> I've completely replaced "var" with "let" in my es 2015 code, but I
> noticed most variables I introduced never change.
>
> Should I replace them with "const"? Will there be any performance gain for
> most browsers? If so, should such performance gain be considered micro
> optimization?
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150417/a1aed8a3/attachment.html>


More information about the es-discuss mailing list