JavaScript variables: var and let and const
prestonlamb.com
JavaScript variables: var and let and const
1–10 of 69 posts
Re: JavaScript variables: var and let and const
#2Re: JavaScript variables: var and let and const
#3https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
Re: JavaScript variables: var and let and const
#4I know it can be confused with `var`, but no one should ever use that now that `let` exists.
One of these days I'll write my own little language that compiles to TypeScript or something and fix that :)
Re: JavaScript variables: var and let and const
#5https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
Re: JavaScript variables: var and let and const
#6https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
const doesn't do shit and we all know it
Was a great intro, and absolutely true. Unfortunately I don't think this will catch on, although I agree with the author that it should.Re: JavaScript variables: var and let and const
#7https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
Does JavaScript have value types where const might work the way the first author expects it to?
Re: JavaScript variables: var and let and const
#8Having used Kotlin for a while now, I find it really unfortunate that `const` wasn't `val` for the sole reason that it's 5 characters instead of 3. `val` would have matched nice with `let`, and my multi-variable declaration statements could have had a nice 4-space indentation while still being all aligned. I know it can be confused with `var`, but no one should ever use that now that `let` exists. One of these days I…
I suppose when I get to use voice recognition for coding, there will also be less confusion.
Re: JavaScript variables: var and let and const
#9https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
Re: JavaScript variables: var and let and const
#10https://jamie.build/const https://twitter.com/dan_abramov/status/1208369896880558080
Does JavaScript have value types where const might work the way the first author expects it to?
IMO it's not just a problem of const vs let, because it'll pop up again when you're trying to copy a JavaScript object, and it'll pop up again when someone has questions about garbage collection.