Why is there so much hate for JavaScript out there?

Why is there so much hate for JavaScript out there?

Some things I want to mention:
- It's the most active and popular language on Github (githut.info or businessinsider.de/the-9-most-popular-programming-languages-according-to-the-facebook-for-programmers-2017-10?op=1)
- It's the only language for front-end development, so a safe bet for job opportunities
- It is getting better and better with the new versions, e.g. ES6
- It can be used in the back-end, too
- Clean syntax, multi-paradigm, universal support, has everything a programmer needs.

My impression is that people hate JS because of its history (granted) and because they don't know how to handle a dynamically typed language.

I'm working as a React/React Native developer and I like JS

I don't have problems with memescript itself, it's an extremely useful tool.
My problem is with what poojets, ad-companies,
"code artisans" and shady websites use it for. And how many modern websites simply not viewable without it.

Sup Forums hates it in order to be contrarian. That being said, dynamic typing is not the problem, but JS being weakly typed is the problem.

Unrelated (functional) fizzbuzz.
Array.prototype.append = function(element) {
return this.splice(0).concat(element);
};


var repeatElement = (function explode(list, element, length) {
if (list.length != length) {
list = explode(list.append(element), element, length);
}

return list;
}).bind(null, []);


var shiftGenerator = (list => () => {
var element = list.shift();
list = list.append(element);
return element;
});


Function.prototype.cutOff = function (stopAfter) {
var that = this;

return function () {
return that.apply(this, [].slice.call(arguments, 0, stopAfter + 1));
};
};


var printLine = console.log.cutOff(0);

var count = (((counter) => () => ++counter)(0));

var fizz = shiftGenerator(repeatElement('', 2).append('fizz'));

var buzz = shiftGenerator(repeatElement('', 4).append('buzz'));

var select = (fizz, buzz, number) => fizz + buzz ? fizz + buzz : number;


repeatElement(null, 100)
.map(() => select(fizz(), buzz(), count()))
.forEach(printLine);

Sup Forums hates everything.

But Javascript deserves its hate.

> The this keyword.
> The standard Array methods are an unclear mixture of mutable and inmutable methods.
> No integers

But the truly unforgivable sin is:

> Utter garbage type system.

For once, dynamically typed languages are a stupid idea, decent languages have type inference, which is what you want to avoid redundant declarations in your code.

Sure you might do hacks like concatenating a string with a number, without explicit casting, and save the hassle of writing a word. But good luck testing that shit.

> The this keyword.
Its usage can be learned and its not that hard. It can actually become quite useful.

> The standard Array methods are an unclear mixture of mutable and inmutable methods.
> No integers
The mixture is clear to me and integers are not needed in that language, just numbers.

Just btw, this is FizzBuzz in Vanilla JS:
for(let i=1;i

that's pretty neat, like typical silicon valley type stuff? what company do you work for?

>for(let i=1;i

>It's the only language for front-end development, so a safe bet for job opportunities
You won't be writing plain JS on the front end. Never ever.

You'll be using shitty frameworks like Angular, Vue or React or whatever some asshole comes up with. And as is the case with Angular, you'll be switching versions every 3-6 months or so, because the fuckheads at Google or whatever company just say 'lol fuck it, version 2 sucks dick, let's completely rewrite the framework and make it version 4' and then you'll have to learn the framework from scratch, since they're not backwards compatible.

You'll be lucky if you'll only have to deal with JQuery since it's old and somewhat stable and backwards compatible, but God help you if you have to use modern JS frameworks like Angular that popped up recently.

dude that's genius, that's pretty cool

This is supreme bait but I'll bite.

>It's the most active and popular language on
Github
The "worse is better" doctrine has always held. PHP spent many years being the most popular language and it's no surprise JS displaced it.
A majority of the reasoning however is that half the web is front end, and
>It's the only language for front-end development
So we're forced to use it. That's not a good sale.
>It is getting better and better with the new versions
"We have been working hard at polishing this turd"
>Clean syntax, multi-paradigm
This is the most debatable. This recent "JS is functional" meme came after years of declaring it was a procedural language, before ES6 made a big deal of saying "we're an OOP language", and then with no changes to the language, functional languages got popular and "we're functional too".

Why would you use arrow functions (from ES6) but still use var.

That just makes no sense.

>empty string + empty string = false

Scoping.

i don't even know JS bu this line is perfectly readable (if you add some spaces)

I just use let for scoping. Makes more sense syntactically.

>this line is perfectly readable
console.log([condition] || i); is not intuitive

>just use let everywhere
For global scope, let and var has no difference.

That's why he doesn't have to use let just because he is using arrow functions. The var keyword is not replaced.

>console.log([condition] || i);

actually it's (for i = 2 (it starts at 2))

console.log(concatenation of 3 % 3 (0) and 2%5 (2) || i)

Which is even less maintainable. It works though.

>>just use let everywhere

read it as "for this scope allow (let) somevarhandle = somevalue"

I don't like "this" either, so I just write all my JS code without using it. I also don't use "new" or the language's built-in constructors, except when I have to use it to create instances of built-in API or third-party library constructors. I also never use prototypes except in cases where I absolutely must maximize performance (and I would make sure to actually measure performance in those cases to make sure it mattered).
By avoiding "this", "new", constructors, and prototypes, I end up using a nice clean subset of the language.

They are brainlets who cant understand the flexibility and power of prototypes and weak dynamic typing

range = (length) => {
return (function range() {
if (this.length < length) {
this.push(this.length);
range.call(this);
}
return this;
}).call([]);
};

select = (i) =>
(i % 3 == 0 ? "fizz" : "") + (i % 5 == 0 ? "buzz" : "") || i;

printLine = (i) => console.log(i);

range(100)
.map((i) => i + 1)
.map(select)
.forEach(printLine);

jack of all trades master of none
>dumb hipster coffee language

>Why is there so much hate for JavaScript out there?
Misconceptions, nothing more...
People don't know what the ECMAscript standard is and what browser APIs are, which is the reason why their browser is a resource hog and why it is slow.

holy fuck, your fizzbuzz is so bad... you don't seem to know what you're doing at all

>you don't seem to know what you're doing at all
You make a FizzBuzz that doesn't use modulo then.

I was not talking about the fizzbuzz approach... I was talking about the specific implementation, which is bad. GL in 2018 to you

It's insane how half-assed ES6 was.

For a scripting language it's good. To think you could write a high performance game in it is nonsense. So it depends on what you're doing with it. I enjoy writing js but do wish it were typed. Flow/typescript just don't cut it.

Javascript is only getting better because of typescript. It's useless without it. Also one of the most unsecure languages out there. If you want to take control of a computer it's as easy as running a few scripts on a site and hiding a few things to avoid virus protection. Scope, dynamic, and not ment for oop really shows how archaic the language is

This is well-said. Crockford's "good parts" alone are basically all I use even if it's a meme. Sometimes you have to use new (new Promise(), new Set(), etc) but overall it's easy to avoid in the vast majority of code.

It's not though. Python destroys it for a scripting language. Why would anybody use Javascript other forced to for the web

Lack of context switching server-side to client side is nice. Python is objectively better imo but js used by people who know what they are doing is fun to work with.

what's a good update on Crockford's book? there's some weird stuff in it that confuse me like the 'this/that' that i wish were explained more thoroughly for an idiot like me

Some people hate it because of what it's used for:
>bloated electron crap
>"disable adblock" popups
>"subscribe to our newsletter" popups
>tracking scripts
>browser fingerprinting
>bloated websites

>integers are not needed in that language
Yeah, the only language that can be used for browser scripting and has one of the largest userbases definitely doesn't have a need for one of the most basic data types present in virtually all non-meme languages.

There is only one thing you should know about this, never use it.

>integers are not needed in that language

kys

It's a normie language so Sup Forums naturally hates it. PHP was hated on for years here, but now that it's not mainstream anymore everyone circlejerks to it.