News for hackers. Stuff that matters.
Re:JavaScript variables: var and let and const by allenskd on Friday March 06, 2020 @02:42PM (#22506575)
That's amazing. I was just scratching my head about const when I read the article, "so what's the purpose if I can change the value... but I guess I can't re-assign the variable with a new value .... that's it?"

I still found the article incredibly informative, sadly as someone still stuck working on legacy apps it falls into "...in some near future I'll take advantage of JavaScript new stuff"

Re:JavaScript variables: var and let and const by karatestomp on Friday March 06, 2020 @04:46PM (#22507635)
> That's amazing. I was just scratching my head about const when I read the article, "so what's the purpose if I can change the value... but I guess I can't re-assign the variable with a new value .... that's it?"

If the value is a primitive, you can't change it. If the value's a reference you also can't change that, but of course you can modify whatever that points to.

Is that what's bugging people about this?

Re:JavaScript variables: var and let and const by allenskd on Friday March 06, 2020 @05:58PM (#22508159)
I believe so. I don't make a big issue out of it... but anything carrying the word const I expect it to be fully read-only with no "buts" in between throughout the whole execution of the program. I guess if they used "readonly" as C# it would make more sense?
Re:JavaScript variables: var and let and const by Kaze404 on Friday March 06, 2020 @03:00PM (#22506751)
If you're willing to add a build step to the project, Babel will let you use all the new features and compile down to whatever version you need.
Re:JavaScript variables: var and let and const by allenskd on Friday March 06, 2020 @06:10PM (#22508246)
Thanks, I've never checked out Babel. I will truly suggest that to my lead, seems something we can take advantage of.