Here’s a very, very simple example of why you need integers. There are many algorithms in Computer Science that rely on the properties of integers. Suppose in JavaScript, you divide 2 by 3:

x = 2 / 3;

Is x == 0.666 or is x == 0?

Both are correct, but in different contexts!

In your MDN link, it states that arrays are “high-level, list-like objects.” How weaselly! You don’t program with them in the same way as in other programming languages. The use of push/pop to add to and remove from the end of an array, unshift/shift to add to and remove from the beginning of an array, indexOf/splice to delete an element from an array, and so on is so goofy and unintuitive and inconsistent. There’s a lot more ceremony to using simple arrays. Why is the beginning and end of an array treated differently???

NONE of your array experience from other languages can carry over to JavaScript. This is just added cognitive friction. And it’s so unnecessary! There is absolutely no benefit to programming arrays in this manner. None. Nada. Zilch. It’s a colossal waste.

I imagine there are uncommon situations where this kind of approach may be useful. But why impose this nonsense on everybody else who just wants to use simple arrays???

JavaScript chose “C-like” syntax for familiarity sake, and yet we make people use arrays in a very unfamiliar way. This makes no sense at all.

NOTHING prevents all the errors and quirks in JavaScript. Linters, for example, can give you false positives. Linters are not perfect; they don’t catch everything.

JS can be used in a variety of areas. It’s a fairly versatile language. Too bad it’s also a retarded language. Versatility does not trump all. I’d rather use a language that is more pleasant. I’d rather use a language that doesn’t hang over my head like the Sword of Damocles. I’d rather not have to walk through a minefield.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store