What a nonsense article! Even worse, it is not even meant to be a scoff (ironical comment) and in addition comes from an author who describes himself as … “Front-end Advocate || Meta Certified React JS Developer || Mentor || Speaker || Blogger”.
After introducing some already well known facts and some statistics about the overall usage of JavaScript the author out of the blue opens an entirely different topic, switching to merely assumptions, personal opinions which are not backed by even a single fact.
While showing a lack of profound understanding of the language himself, the author starts speculations about why the language might be a subject of hatred.
Let’s have a look into the author’s list.
Reason 1: Dynamic Typing and Type Coercion
The author should have used time and energy to explain why there are var
, let
and const
available for declaring a variable/constant, what are the differences and why one should always stick to const
, fall back to let
under certain circumstances/conditions and never ever should use var
.
Reason 2: Global Scope by Default
The author does not know what he is talking about. The example, even though it shows global scope, does not back the author’s claim. The example-code applied within global scope of cause declares bar
exactly there, but the same code applied within a module’s scope hides bar
from the global scope.
One can not come up with a poorly chosen example in order to back ones own mental misconception.
The correctly chosen example would present an assignment to bar
where bar
is neither preceded by var
, nor by let
, nor by const
. Such an assignment regardless of the current scope makes a variable always global. This is a well known fault of the language and a reason its usage is discouraged.
Reason 3: Prototype-Based Inheritance
This one would be laughable, if it was not actually too sad that one tries to argue over a core language feature. If one choses a certain language or even is forced to program in it, one should not complain about its design. A developer’s utmost duty is to learn and use language features properly. By the way, JavaScript is by far not the only language that uses prototypes and prototypal delegation.
Reason 4: Inconsistent Browser Implementation
“JavaScript can behave differently in various web browsers, leading to compatibility issues and extra work for developers.”
That one is just plainly wrong.
Reason 5: Scope Confusion with `this` Keyword
And this one finally renders the author’s reliability close to zero, because the self proclaimed “Front-end Advocate and Meta Certified React JS Developer” confuses scope and context. The former targets variable visibility within modules / functions / blocks, whereas this
points to the latter (context).