Why is JS so shitty? Looks like some adderall adict kiddo was behind the development of this attrocity

Why is JS so shitty? Looks like some adderall adict kiddo was behind the development of this attrocity

Other urls found in this thread:

foo.bar/${text}.json`
v8project.blogspot.de/2017/02/v8-release-57.html
twitter.com/NSFWRedditGif

Works for me and on my machine.

Working shit still shit

>type "manager."
>auto-complete gives me 50,000 options, none of them have anything to do with the object
This is why types were invented, Javascript. Why do you hate types?

>Objects
>JS

{}'s are called objects, though you can feel free to disagree with the name since they're basically just associative arrays.

Because it was hacked together in 2 weeks, and grew organically from people in different tech cultures with little communication.

For a coherent language you really need a single vision.

Is there a single scripting language which isn't an incoherent, inconsistent nightmare?

Ruby, Python, Shell...?

Python is so much worse than js

...

You are so dumb.
you are in every JS thread making these dumb points.

First and foremost, if you code like that then you should kys.

the + operator can be either addition or concatenating depending on the type of the operands. The - operator can only be subtraction and nothing else.

If you use the + operator and the first operand is of type string, it will try to concatenate it with the other operand.

The + and - operators can also be used to be the sign of the following number. So if you already have an operator between your two operands, an additional + or - will be the sign of the following operand. So "5 + + 5" is adding five with positive five.
>'5' + + '5'
The second '5' becomes 5 (data type number) because of the 2nd +. string '5' will be concatenated with the number 5 to become '55'.
>'foo' + + 'foo'
Once again, the 2nd + tried to turn the 2nd 'foo' into a number, but it is not a number so it become NaN. Then you try to concatenate 'foo' with NaN, which gives you the expected 'fooNaN'.

Sure you poke fun at it, and you genuinely think it is not consistent. But you really just have not learned the language obviously.

See you in the next thread friendo.

>it doesn't matter if they're completely unintuitive and arbitrary if they're deterministic
What is law of least surprise?

...

It isn't unintuitive nor arbitrary.
If I start working with a string, of course I'd expect the + operator to behave as concatenation.

Works better than your 0.2% language

Or you could just have a separate operator for concatenation. Even PHP figured that shit out.

How is it shitty?

It's probably one of the best scripting languages of all time.

import { foo } from "some-module";
const { map } = [];
const { log } = console;

Promise.all(
document.querySelectorAll( ".foo" )::map( elem => async () => {
const text = foo( elem );
await const response = fetch( `foo.bar/${text}.json` );
await const data = resonse.json();
return data.foo::map( item => item.bar );
})
)
.then( ::log );


tell me one language / api that makes this example task less verbose and more elegant.
protip: you can't

Or you can just use template literals and say fuck addition concatenation.

It's just different. Phps . Operator can be similarly weird

PHP is just weird on the whole. The point is that if you're going to have this kind of automatic type conversion then you better not overload a single operator with multiple completely different functions.

C#

You know if you're really that concerned about adding strings with numbers you can use the unary plus operator right?

Are you retarded or blind or both?

Are you?

Python has way to many statement directives.

Python lacks language feature x in another?
New statement.

It's to the point where the Python grammar just gross.

Please provide an example

He can't

Reminder that anyone who complains about typing in JavaScript is literally just shit at JS.

>Looks like some adderall adict kiddo was behind the development of this attrocity
It's not though, it was a trans- and homosexual hating glorious white male who intended to make a Scheme for browsers with a C-like syntax.

at least JS uses . as method accessor and not that '->' retarded sperm of php

agreed

>dereference notation comes from PHP

Fucking plebs

nobody is saying that

You're right nobody said that, it was implied (in written form).

I guess you also think it was implied that JS invented . notation for accessors.

No, I don't think that was implied because it wasn't.

Just like it wasn't implied that PHP invented -> notation.

But it was....

I'm starting to suspect that you are legitimately autistic.

Are you retarded? That wasn't implied at all

Promises originally came from C#. Now they are copying async and await? I bet Observables are going to be the next shit they copy.

Lua

The JavaScript language specification explicitly calls them object.
The word combination "associative array" is never used in the language specification.

That's what they're called but it's not what they are.
PHP hashmaps are called arrays but that's not what they are.

stupid("all",function()[
async("love",function(){
ifyou("js",function(){
FUCK="don'tneedit"
}}])

Lol whatever this shit isn't funny any longer. Enjoy your severe autism.

And that's why Typescript is so insanely popular right now.

Since JS lacks named parameters, we always have these fucking configuration objects with random string keys everywhere.
The JS using peasant needs to switch between the documentation and his code over and over again because he can't know what arbitrary words the developers of the other library used, while the TS using masterrace developer gets autocompletion and even errors if he types a wrong key.

Typescript's type system is incredibly mature and can express almost everything you can imagine. You should honestly try it.

observable properties have been added long time ago. among with proxies and other stuff

At least they're doing that.
Realizing that other languages have done much better and learning from them.

Just take a look at shit like PHP, where the core devs get 100% anal when someone tries to suggest merging a useful feature from hacklang.
And yet PHP's fanbois hype up its shitty and worthless 1 type only runtime checked scalar typehints and return types (which only work if you explicitly delcare them valid at the top of the file) that came in PHP 7 as if they somehow brought PHP on the same level as C#.

t. 12yo retard who doesn't know what he's doing

The problem with the elegance of JS such as this is simply the overhead and setup required. I mean can you honestly tell me that any other language couldn't be as good with the amount of things thats been done to JS to reach the level shown there?

So what you're saying is JS sucks, every other language sucks substantially more, but JS still sucks?

Do you program or do you just discuss languages on Sup Forums?

This may look nice as code, but the things this code actually has to do in the background to accomplish its task is some of the nastiest shit you can imagine.

nice bs comment, retard...

v8project.blogspot.de/2017/02/v8-release-57.html

I had to use "node.js" which is some kind of piece of shit compiler of some sort for native javascript code. Jesus fucking christ it almost gave me javascript cancer. Now that I know how cryptocurrencies work and all that I wanted to use it for, I can safely delete it off my life and never see it again.

A literal hitler-republican tried to make Scheme user-appaling in 10 days.

/thread

I'm pretty sure javascript auto-coercion rules which can't be avoided for most of binary operators started as a bingo card at netscape.

You're using the wrong operator.

Anyone else here think that javascript really shouldn't be used for servers? I hear things like node.js and socket.io and all these weird shit and all I can think is, "Javascript was originally just a neat way to run some scripts on a machine locally through the web browser... wtf?"

It originally took off because it's natural support for asynchronous IO made it extremely simple to write fast concurrent applications.

Being able to run the same code on the server and the client brings some advantages.
Server rendering for libraries like Angular or React wouldn't really be possible otherwise.

Unlike crap like PHP, JS also has an event loop implemented into the language. Disk operations, database queries etc. no longer completely block everything else while waiting for a response, and those pointless waiting times quickly add up in those synchronous languages.

Other languages that could fill the webserver niche like Go, hack, python or C# are either not popular enough (hard to find developers for) or require more expensive hosting.
Remember that that (and WordPress) are pretty much the reason PHP is still the most used language for the backend despite being the worst possible language for it.
I'm not a huge fan of node.js either, but... it happened. We have to accept it. It puts food on the table.

>which is some kind of piece of shit compiler
>compiler

What?

I was unclear. This is very basic stuff.

But since it seems that ES6 is trying add functional elements lets compare it to Scala.

Scala is better than this straight out of the box and is less verbose. And furthermore does not suffer from the ambiguously of dynamic typing.

And of the prettification on top of JS wont change the stupid way in which it handles strings yada yada.

At the end of the day even the way it is I would never use JS from any non-browser based project.

The 20,000+ line JS tat we have takes almost 6 minutes to be properly bundled/rendered/polyfilled etc meanwhile a similarly sized project in Scala compiles in roughly 1 min 30 secs and ofc will catch WAY more problems at compile time.

So we're right back where we started with JS: browsers and quick and dirty projects.

JavaScript is hilarious though
['10', '10', '10'].map(parseInt)

WHAT

Why is that funny?

>passing index from map as radix of parseInt
Of course you're going to get nonsense. What else would it do?

parseInt expects more than one parameter and map passes 3, dummy

> ['10', '10', '10'].map(Number)
[ 10, 10, 10 ]

BASH
A
S
H