The difference between these two keywords in terms of scoping has already been thoroughly discussed here, but I was wondering if there is any kind of performance difference
FYI; After Chrome v60, no further regressions have cropped up. var
and let
are neck and neck, with var
only ever winning by less than 1%. Real world scenarios sometimes give var
an advantage due to hoisting and re-use, but at that point you're comparing apples to oranges, as let
is intended to allow you to avoid that behavior because the semantics are different.
Benchmark. Firefox, IE and Edge like let
just fine.