I forgot, what is difference between var and let in JavaScript? Something something scoping rules, but I forgot (or never knew?) the details...

Follow

@vaporeon_ let uses lexical scope. var ignores most blocks aside from function boundaries, and also hoists

@vaporeon_

// i is in scope HERE!!
for (var i = 0; i < 10; i++) {
// ...
}
// i is still in scope!
Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.