The Achilles Heel of JavaScript is its inconsistent behavior across implementations. It is virtually impossible to use it to do anything robust on the client side.
This was true years ago, but isn't anymore. Any semi-modern browser has a consistent and well-tested core language and DOM APIs for dealing with HTML/XML documents, event handling, etc.
JavaScript is weakly typed, and the automatic coercions that it does can produce surprising results.
Yes, type coercion can be confusing. So don't do it. Use strict equality (=== and !==), and explicitly convert things to booleans using
! or
!! in comparisons to make your intent clear. It's a language flaw, but not a hard one to avoid.
Rather annoying gotcha in array constructor.
Fair point. Fortunately there's a concise syntax for creating array literals that saves you from ever having to touch the
Array constructor:
[].
Whereas most languages have one universal singular value (null/nil/Void/whatever); JavaScript has three - "false", "null" and "undefined". That leads to confusing and irregular semantics.
false doesn't belong in this category at all. Whoever wrote this is confusing type coercion with nullity. I agree the distinction between
null and
undefined was a design mistake. They should've used
null everywhere. That said, in good code you can treat
undefined like a sentinel: if it shows up in your program, you're probably doing something wrong.
No integral types - the only numeric type supported is an IEEE754 double-precision float. For a scripting language, this limitation is probably less obnoxious than it would be elsewhere.
For any situation where this is important, you can use typed arrays. [1]
Works Cited
[1]
https://developer.mozilla.org/en-US/docs/JavaScript/Typed_arrays