Leo Liu's blog

归档 · 2022

首页

关于

归档

Javascript

Var, Let - What's Difference In The For Loop

We’ve all written simple for loops to iterate over arrays and objects countless times. But have you ever stopped to consider how the scope of variables used inside loops works? I recently came across an interesting code snippet that highlighted an important distinction between var and let in this context. 1234for (var i = 0; i < 3; i++) { const lo..

更多