A
false != x
test failed for a zero-valued x; had to make it !==. WTF? I never want false and 0 to be other than different objects.Almost every twist and turn in this language is an imbecillic clusterfuck.
I had one instance of a if (foo.bar = 0) typo; no warning from the implementation. Why do we want stupid C mistakes in a higher level language, without the C fixes for them?
list.forEach(function (item, i) {
...
});
makes my eyes bleed. JavasSript borrows the syntax of languages geared toward a form of computing at which JavaScript is poorly suited for; when you're combining functions together, it looks like dog's breakfast.To get a value out of a switch statement, you have to wrap it in a function that is immediately called?
function () {
switch (WTF) {
}
}();
the switch statement has the idiotic break with fallthrough found in C.One redeeming feature: A || B || C ... works a lot like (or A B C ...).
Unfortunately, this is required for the simple task of incrementing a nonexistent dictionary key from zero:
dict[key] = (dict[key] || 0) + 1;
this calls for two dictionary key lookups. You want this sort of thing in a single operation.Oops! In the following, j isn't lexical:
for (let i = 0, j = 0; ....
I copy and pasted something like this from a StackOveflow answer into a recursive function and spotted that the j in a recursed frame was messing with the j in outer frames, there just being one j.What is "function scope" and why even have something so idiotic? Just let, or GTFO! C has function scope for goto labels, that's it; why introduce something like that.
Appending together Lists has functional semantics, like Lisp:
a.concatenate(b) // new thing is returned, a stays the same, so you must do a = a.concatenate(b).
But a.push(b) // mutates a in place.
Here is a shitshow, curently with a fitting number of upvotes: 666.https://stackoverflow.com/questions/881085/count-the-number-...
I accidentally wrote
if (foo.bar.indexOf[key] < 0) { code }
code was silently skipped even though foo.bar is an empty list. No diagnostic, nothing. Oh, indexOf is a function, which is an object. Every damned object is a dictionary with properties you can access as strings with square bracket indexing, and that is always safe: it yields undefined if the property is not found.