JavaScript

Daily reminder that Javascript is literally the worst language.

>"\t\r\n" == 0 → true
>"\t\r\n 16 \t\r\n" == 16 → true
>"\t\r\n 16 \t\r\n" == "16" → false

Other urls found in this thread:

stackoverflow.com/questions/5447153/javascript-equality-transitivity-is-weird
google.com/search?q=math major salary
twitter.com/NSFWRedditVideo

And what are you going to do about it?

>({}){}{}(}{)}({)}({)}{(}{)}(}({){)}({){(}(
> {}{}()()({){){){}()()({}(}{({
>return this
>return that

I've never understood the craze about JS. Python is better than it in literally every way.

That isn't even bad OP.

>[+!+[]]+[+[]] == 10

It's like a stairway to heaven man.

Function callbacks are worse than the child of Justin Bieber and Rebecca Black.

Obligatory "I don't know what promises are nor know how to use generators or coroutines" therefor JS is bad.

Obligatory "You can do this shit that noone will ever actually do and it doesnt produce the results I expect so it's bad"

Typical.

You must be one of those "code artisans" that work on a "cutting edge" NodeJS + MongoDB stack with Docker with 231809 stickers on your MacBook Pro in a Starbucks.

>Use weakly typed programming language
>Mix different types like a retard
>Wtf, it does something weird!
It's not that JS is a bad language, it's that you're a bad "programmer".

haha go fuck yourself

...

Everyone knows double equals does the wrong thing, this is your fault for not using triple equals.

...

A challenger appears!

Gah! My eyes!

Reminds me of this stackoverflow post I read a while back. stackoverflow.com/questions/5447153/javascript-equality-transitivity-is-weird

'' == '0' // false
0 == '' // true
0 == '0' // true

false == undefined // false
false == null // false
null == undefined // true

I mean, there's always ===, and the top answer explains the implicit type conversion black magic that happens under the hood, but it isn't exactly intuitive behaviour.

Functional languages, not even once!

>Javascript
>functional

I heard you were talking shit. ಠ_ಠ

I am pro javascript programmer with many many years of experience.Lets clear some things about JS.

AMA

This

Javascript has the bare minimum of features required to be called functional. Its functional-lite

wtf are you talking about? Javascript is functional, just not in the Lisp sense. Do some theory first before classifying languages on your own

You should always be using === if you don't understand coercion.
>'' == '0'
'' (empty string) is not equal to '0' (string of length 1) this is super obvious.

>0 == ''
Zero coerces to boolean false and so does empty string.

>0 == '0'
The string '0' is coerced to a number because of the zero on the left side, and zero does in face equal zero.

Null and undefined are both falsey so they evaluate to false in an if statement but are not equal to false.

It is really easy to follow if you actually know a thing or two about the language you're coding in.

Any language whose lambda syntax is as clumsy as Javascript's doesn't deserve the title. Don't even get me started on flagrant mutation and other side effects pervasive throughout the language.

A functional language must have functions, and something that has side effects is a procedure, not a function. Sure, you can do functional programming in Javascript, but you can do that in any procedural language with closures. Doesn't make it a functional language.

() => {}
ain't pretty enough for ya?

>functional programming is only pure functional programming
ML say both hi and fuck you.

What is it doing here exactly? Is it like char addition in C but you dont need single quotes?

Except that the syntax everyone actually uses because it's available everywhere is:
function (x) { return foo(x); }
Which has its own awful syntax gotcha, but everyone already knows this and deals with it.

JS is certainly a useful and ubiquitous language, but it isn't a functional language.

(You)

So any language with closures is now a functional language?

You have a Javascript REPL right there, press F12.
> +[]
< 0
> !+[]
< true
> +!+[]
< 1
> [+!+[]]
< [1]
> [+!+[]]+'0'
< "10"

>it isn't a functional language
disagree, by definition such a language is a language which both supports the paradigm and has facilities dedicated to it, and given the popular use of callbacks and ubiquitous support in the standard libraries for using functions as data, I'd argue it's got both of those.

hurr durr i am retard and going to compare strings with integers
what a shitty language

>Sure, you can do functional programming in Javascript
>it doesnt make it functional language

Do you realize how elitist and pretentious you sound?

I said it is not functional in the Lisp sense but it is functional. Go figure.

Typescript is where its at. Vanilla javascript? Bleh

You need to see the beauty of Clojure.

Nothing wrong with that, tard

>==
No one uses that in real code.

What is worse IMHO is the browser environment it runs in.

No, it's not. Python is only much better when it comes to its std lib. The language is garbage, like every 90s dynamic scripting language and lets not begin about implementations...

How does it feel to be living in 2010? Literally every Javascript codebase I've ever used uses () => syntax.

>javascript
>worst
Do you even Java? There's the JAVA in JAVASCRIPT. Always think about JAVA

>hurr durr what are promises and async/await

garbage that doesn't clean up the mess, just like the class syntax sugar and other stuff ES6 introduces.

So what would you suggest then? Just freezing the UI while waiting for any network request?

ok kids, get this through your ritaliine riddled heads, == does casting, its for comparing values, === is for comparing identity between objects

this thread is proof that Sup Forums is full of clueless basement dwellers

ITT: brainlet "bootcamp" grad and / or NEET web devs who don't know about coercion.

>professional javascript programmer
>live and work in nyc at a successful startup
>make over 6 figures
>love the language

8)

lets see how far that "c" language of yours gets you kiddo

Nice. Making 160k in Seattle here.

Obligatory strawman

Native GUIs, as it should be.
However, seeing to a browser specific solution I prefer simple callbacks to promises, no matter the nesting, as unlikely as it sounds.

nice meme

How is Javascript + HTML not a native GUI?

He's right, you know?

its not a meme my dude :^)

I program weapons systems in C++.

I never used a Macbook or been inside a Starbucks my entire life.

>"16\r" == 16 → true
>"16\t" == 16 → true
>"16\r" == "16\t" → false
I see javascript's developers failed basic math hard enough to not know what transitivity is

Why should the == operator be transitive? It's not testing equality.

are you mad because you are too dumb to understand it?

It's not directly drawn by WinGDI/DirectDraw/OpenGL/Whatever.
Instead, it is made of DOM elements that carry all kind of unnecessary state along which leads to borderline responsive GUIs.
Not even the best of the best - the VSCode devs, which are so far superior, as I'm happy to tell you - are able to solve the problem.

Also, from a developers aspect, it's the worst of both worlds. Well made high level frameworks like Qt are far easier to use than rigging stuff together with the document based piece of shit that is CSS, but on the other side, managing layout myself and drawing my own widgets is easier as well.

Another aspect is, web code artisans feel free to break established using patterns. For example, Dropbox devs decided that is was acceptable to hijack right clicking. Etc pp.

I've used Node and Docker yes. I've never used mongo in production but for side projects its the simplest DB to use. I dont have stickers on my MBP.

I dont think node.js is "cutting edge". Node.js uses a cooperative scheduling algorithm as seen in old operating systems such as MacOS 9, Windows 95 running legacy 16-bit code, MS-DOS and so on. I write it because I get 150k a year to do so, and since i'm stuck with it, instead of bitching about it like Sup Forums does i've simply found nicer ways to write JS. With async..await and a simple linter, most of the problems people have with JS are eliminated, and you can add typescript on top of that for static analysis.

There are better languages, but people spend to much time bitching about a perfectly capable language. Their alternatives are not much better. Personally i'd prefer to use OCaml or Elixir, but there's not a huge amount of work for it.

you mean 16 == 16? wow!
and two different strings are not equal? surprise!

>shit vs poo
It's going to be a hell of a fight.

...

Any unresponsible GUI you have encountered is 100% from the network requests it issues, not the underlying DOM engine. The DOM engine is extremely fast. And please tell me how Qt XML files and Qt Style Sheets are any fucking different than HTML and CSS, or anywhere in Qt that prevents you from implementing a custom right click menu.

There's a surprising amount of titty in that eye shower pic

yo dawg docker is the shit

Learn to babel

You code like this then you retarded

>Any unresponsible GUI you have encountered is 100% from the network requests it issues, not the underlying DOM engine.
This is bullshit. People here want to make fun of callback chains, but callbacks are a great way of stopping bottlenecks and thread starvation. Most unresponsive GUIs are caused by code monkeys who have no clue which code is blocking and wasting up CPU time

>maths major
>any job I want
>300k starting
You can't beat that.

nice meme
google.com/search?q=math major salary

i wish javascript would implement optional typing

>what is Typescript
>what are type annotations

nice newfag

Fucking retard, that isn't a strawman

The average prostitute in the US makes six figures. That doesn't mean sucking unwashed cock every day for a living is something to be proud of.

Why don't you stay on Reddit?