News for hackers. Stuff that matters.
Re:JavaScript fundamentals before learning React by austincheney on Friday July 20, 2018 @07:16AM (#17574031)
The biggest fundamental is that you only rarely need new (when forced upon you by a bad API) and you don't need this (not ever).

That statement has worked well for me in this language. I know it causes many people to cry and get immediately angry. The bottom line is that they increase the verbosity (substantially) of code, they are completely optional, and they often compound code maintenance through a more convoluted flow control.

Re:JavaScript fundamentals before learning React by Silhouette on Friday July 20, 2018 @07:26AM (#17574088)
I can understand not liking `this` in JavaScript, but it seems optimistic to say you never need it. If nothing else, you are bound to encounter large amounts of code that uses it, so being familiar with its behaviour is necessary to understand that code.
Re:JavaScript fundamentals before learning React by DonHopkins on Friday July 20, 2018 @07:39AM (#17574150)
"... but it seems optimistic to say you never need it. If nothing else, you are bound to encounter large amounts of code that uses it"

Wait -- JavaScript now supports "it"??! Can you iterate over "them"? At least it's not gendered, so you need to use "him" and "her" and "it" depending on the object's gender, or just keep everything in a collection so you can use "them".

Re:JavaScript fundamentals before learning React by josephg on Friday July 20, 2018 @08:06AM (#17574303)
this also has some really fun rules that are useful for mad science sometimes. For example, you can recover the JS context's global value via this:

    (function() { return this })()
In a browser this resolves to the window object. In nodejs it resolves to the global object. I've used this a few times to help write isomorphic javascript bundles, though its much less useful than it once was.