impresently:
a little confused
I know how you feel, Iâm not new to JavaScript and I donât understand it well enough to easily explain it, but it has to do with âclosuresâ and âlexical scopeâ
I think the âCreating closures in loops: A common mistakeâ section near the end of this page does the best job at explaining that Iâve seen.
MDN Web Docs
Closures
A closure is the combination of a function and the lexical environment within which that function was declared.