JS Shenanigans

Attached: lol.png (425x167, 9K)

>==
cringe

What's wrong with this?

weak typing bad

>==
brainlet detected

>==
At least learn what you're doing.

OP's brain is too small to handle dynamic languages.

There's literally nothing wrong with this, just use === if you don't wanna deal with it. When using == with operands of different types (with the exception of null and undefined) they're compared as if they were converted to Numbers.

Oh and for String to Boolean conversion, the empty string is falsy and any other string truthy.

this but unironically

Imagine using a language so shitty that you need an equals operator as well as a "no really, I mean equals" operator.

ddddddumbass

>More than two equals
>More than two genders

JSfaggots confirmed for tranny enablers.

What "==" is supposed to do in JS?

It's a poorly implemented Python == that leads to the sort of results you might expect from a language whose core was completely developed in 10 days.

Comparison with type coercion.

It's a comparator that works between types.

Attached: pjrpnjyynjtz.jpg (659x317, 31K)

>0 is false
>1 is true
>any string is true

How is this bad? I'm sure most if not all languages do this

how is "\t" == 0? is it because it's white space?

>I literally cannot comprehend what a subset is

Attached: 1.png (220x229, 5K)

For String to Number conversion whitespace is stripped first and the empty string is converted to 0.

When you say
>Python ==
you are saying that JS mimics what "==" Python do?
LOL, that's kind weird, what do you guys use to compare the same kind of type?.

Falsy and truthy; disgusting

From the tutorial:
An equality check converts values using the numeric conversion (hence "0" becomes 0)

>what do you guys use to compare the same kind of type?
===

absolutely niggerlicious

Name a single positive thing about this that is relevant to people with triple digit iq's

([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[])[+[]]+(!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]
the above is a fun little example

You can compare things simply without having to bother with changing types.
>b-but if you have a triple digit IQ then its easy to change the types and then compare them!
Or I could just not.

> alert
> this new language I'm learning doesn't do things like the last one

oh no

>literal reddit spacing
>also literally retarded
pottery

Attached: kek.gif (540x304, 1.52M)

If they have the same type then it doesn't matter whether you use == or === or do you mean to see if two values have the same type?

WEAK TYPING BAD

>being a low IQ web dev
This is the reason you people come up with a new framework every month but all of them are equally shit.

>also literally retarded
said a fucking animetard

alert([] == ![]); // > true

This is why TypeScript exists

LOL my question doesn't make sense, if it is the same type it really doesn't matter, but then the following question bugs my mind: why do JS have "==" and "==="? The "==" should not exist, because it's not the same type.

([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]

Attached: 1568582859195.png (538x480, 170K)

What I mean is on a very high level the concept of == in JS and Python seem to be seeking to accomplish the same ends, but JS version is completely unusable and worthless.

>i have no apples in my bag
>i have no bag at all
both cases you still have no apples

But undefined

Fuck TypeScript. Pros are waiting for the next-level language that compiles down into TypeScript.

>quoted cuckold deletes his post
oh nonononono

>Let's just build on a shitty foundation instead of digging it up and laying a sound one.

I hate the argument in favor of transpiled JS derivative shitlangs almost as much as I hate JS itself.

What is this JS gutterlang pilpul?

alert(Boolean([]) == Boolean(![])); // > false

Attached: consider it.jpg (500x375, 60K)

>completely unusable and worthless
Agreed

But theres no sign ever that this Javashit problems are going away in the future standards. Typescrupt is your best bet

JS should be forcibly removed from the standards by government intervention.

>be a redditor
>fuck up Jow Forums formatting because of the brain damage
>use the delete post function to "edit" your post
>still use reddit spacing

Attached: 1564290902646.png (571x618, 41K)

JavaScript's problems will never go completely away because browsers need to maintain backwards compatibility. They can be replaced with better alternatives though, which is already happening, just don't use any of the older features and JavaScript is actually a pretty decent language in practice.

Well that proves it, c# is clearly better! -retarded enterprise developers who can't write javascript.

All these problems have gone away you retard. Just press = one more time. You stupid kids have 0 knowledge of programming.

The entire language was honked from the start. It should be replaced. Its golden calf status is bullshit.

Great completely empty argument with no facts you stupid kid. You just repeat the same shit you hear from some other stupid person.

Just use === if you want strict comparison. That is what all good programmers use by default. You can even set it to warn you when you use something else with eslint if that is your thing. But you dumb fucking kids pretending to be experts on the internet don't know shit about anything.

=== looks gay

Anybody in this thread defending javascript needs to fuck off back to whatever bootcamp they came out of.

>N-no you can never replace the language completely designed and implemented in 10 days! It’s not fair! We invested so much time building sandcastles!

Only because you're imagining it as a penis larger than your own.

What kind of person enthusiastically learns JS? Everyone who has used a real programming language wants to vomit when they realize what they would be dealing with if they decided to use it.

Yeah, no, you can't because the whole internet is built on it. Tens of years of website content that relies on JS to run won't ask for your permission to exist.

>Yeah, no, you can't because the whole internet is built on it. Tens of years of website content that relies on Flash to run won't ask for your permission to exist.

>thinks he can build something like v8 in 10 days.
>doesn't understand what an ecosystem is.
>thinks he can replace the millions of javascript libraries easily
>thinks it is easier to do this then press = one more time on the keyboard.

Fucking retards.

Evaluate
['1','2','3']. Map(parseInt)

And be amazed

> I literally cannot tell the difference between equality and identity

It's not really that amazing once you realize that #map passes multiple arguments into the callback

For me there's more of an incentive to build shit with JS. I suppose it's because a lot of things are visual or interactive. For the longest I've been stuck in tutorial/book hell with other languages, but I actually do things with JS. Maybe it's meant for retards like me, so that's pretty good. The language lacks coherent design throughout but you can get around most things I've found so far, so it's not that big of a deal. Why does JavaScript's warts bother you faggots so much but bring up the flaws of Unix or C and you turn to apologetics? Both Unix and C have introduced a large mass of cancer, C alone is largely responsible for the 'security' industry.

Because Jow Forums only likes autistic things. The only languages Jow Forums likes are as close to the metal as possible, anything else is impure, inconsistent, not minimalistic enough.

So if you ask them, they hate C++, they hate Java, they hate C#. The only thing that Jow Forums autists appreciate is C and assembly. That's all. Nothing else.

Jow Forums are basically the wahhabists of programming. Except the lame, socially awkward version of it.

The idea is typescript can me mapped to other languages and not just JS one day. Check out Deno.

>I'm not knowledgable to make any arguments criticizing javascript so I'm just gonna call you a shit programmer instead
Sounds like you should learn 2 code and come back in a year or so.

I'm a C++ and Javafag and I hate JSWebdevs more than retards with C hacker syndrome.

Then you're a boomer.

Attached: 384u6b.jpg (500x586, 96K)

For references that use pointer semantics, == compares identity, because the identity of what is being referenced, and the underlying value of the referece are semantically the same, that of the address of what is being referenced.
For references and values that do not use pointer semantics, == should compare value.

the only languages that have this problem are the ones that have to hide the concept of pointers to help retards

I hate that an empty list defaults as truthy (instead of false).
let arr = [];

if (arr) { // arr is truthy so this branch works
console.log(true)
}

It's so annoying, and I swear JavaScript is one of the only languages where this happens.
You have to do
let arr = [];

if (arr.length) {
console.log(true)
}

instead.

Watch me faggot. Browsers will be destroyed and I will create a new standard in three days.

You could just do:
Boolean([]);

>muh ecosystem
>implying javascript libraries are irreplaceable and 95% of them aren’t a bunch of useless tranny bloat

eat a tidepod

>Sunkcost fallacy

Fuck off kike. Your software is shit and should literally be illegal.

You think calling an object wrapper to test a boolean is necessary just for a conditional statement? arr.length is better than Boolean(arr) , but it's stupid JavaScript cannot automatically detect the truthiness of an empty list.

use C# faggots
or at least Lua or Python

> I dont need shortcuts to make my code smaller
Need to compare user input with a number?
Yeah just do
```
try{
int num = atoi(user_inp);
if(user_inp == mynum) doshit();
}
catch{
//oh no the user input was bullshit and not a num
throw UserAnIdiot;
}

I don't know how to code block
Don't judge me.

>weird mix of C and C++ style code
>using exceptions
>unironically advocating for non-static typing because muh development time
I am judging you, but not because of that.
I'm not even sure what you meant by this, what does this even have to do with the fact that obfuscating pointers is bad and that identity of a type should always be calculated by an explicit equality check of a reference type with pointer semantics rather than an equality check of what acts like a non-reference type with value semantics but is actually just a pointer under the hood?

And what do you think happens when you wrap it in an if statement?

I love deno

>The entire language was honked from the start
This non-argument seems to be your best argument because I read it at least 10 times in this thread.

You really are a retard. It is not cost but existing value what the user was talking about. Read an economics book maybe?

JS is not valuable in itself retard. The websites are. Of course a retard like you thinks the JS IS the product. Fuck you and die.

>I don't know how == works in JS, but complain anyway general

I think you're misunderstanding, my point is the branch if statement works, not the body of the if statement. E.g.
let arr = [];

if (arr) { // arr is truthy so this branch works
// do this
}

so?
1) cast int(0) to bool = false
2) cast object, non-empty string to bool = true
3) compare int to string, which is done literally = true
are you somewhat retarded, OP?
you can do operators in C++ behave the exact same way with your custom classes,
even your own string class that could behave *exactly* like this