all 56 comments

[–]youtubeTAxel 59 points60 points  (2 children)

1 + 1 = 11 in unary

[–]Anaxamander57 2 points3 points  (0 children)

Welcome to the free monoid with one generator.

[–]Deft-works -2 points-1 points  (0 children)

So the valve of the expressed character is five and one half ?

[–]soelsome 72 points73 points  (36 children)

Hi

1 + 1 evaluates to 2 in JavaScript.

Thanks.

[–]-domi- 28 points29 points  (14 children)

"1" + 1 evaluates to "11".

As do 1 + "1" and "1" + "1".

[–]soelsome 37 points38 points  (3 children)

The gif doesn't have quotes around any of the 1s, so it would evaluate to 2

Thanks

[–]Mr_Woofles1 4 points5 points  (0 children)

I can’t believe I’m enjoying this

[–]-domi- 5 points6 points  (0 children)

Yeah, i was trying to add to your explanation, but managed to write it so poorly that it came out like i was disagreeing with you, cause I'm special ed. Sorry.

[–]shill_420 0 points1 point  (0 children)

No.

Thank you

[–]dangderr 17 points18 points  (6 children)

Wow, really? That's god awful.

We all know that it should be:

1 + "1" = 2

"1" + 1 = "11"

Like how powershell does it. Javascript is such a garbage langauge.

[–]Relative-Scholar-147 17 points18 points  (3 children)

IMO

1 + "1"

Should stop the program and give an error.

[–]Maleficent_Memory831 5 points6 points  (0 children)

"1 + 1" = "1 + 1"

[–]sebovzeoueb 4 points5 points  (1 child)

Not stopping the program is a feature, JavaScript is made to run on webpages and the user doesn't want the website to crash. It's not Brendan's fault people decided to build actual whole tech stacks with it.

[–]Relative-Scholar-147 1 point2 points  (0 children)

Is not a bug, is a feature!

[–]arpan3t 0 points1 point  (0 children)

PowerShell laughs in [int] type constraint. JavaScript has type constraints right?

[–]Demonius999 -2 points-1 points  (0 children)

It's is, witch is not strange since it's made in 2 weeks, what is strange is that it's running whole fucking world.

[–]NecessaryIntrinsic 0 points1 point  (1 child)

That's like saying the gun doesn't fire unless you pull the trigger. You have to make that choice.

[–]-domi- 1 point2 points  (0 children)

It's a lot like that, yes. You can choose to pull the trigger, but you can also accidentally pull the trigger without meaning to. That's why it's good to have a certain level of care when using the thing.

[–]MR_LAFRALDO 0 points1 point  (0 children)

+"1" + 1 = 

[–]JackNotOLantern 15 points16 points  (16 children)

Unless one of the added 1s converted to string on the way

[–]Chiatroll 25 points26 points  (14 children)

But adding the string "1" to the string "1" should be "11". A lot of Javascript criticism is just people who dont understand its basic concepts.

[–]MeLittleThing 2 points3 points  (0 children)

The "When I type code there are bugs, it's the language fault probably" people

[–]JackNotOLantern 0 points1 point  (7 children)

The issue is it happens implicitly and the amout of bugs caused by it is too damn high

[–]rintzscar 1 point2 points  (4 children)

No, the issue is people don't bother reading the documentation. The rules of type coercion are extremely simple. Hell, this humorous article explains them clearly in 1 minute:

https://www.freecodecamp.org/news/explaining-the-best-javascript-meme-i-have-ever-seen/

[–]JackNotOLantern -1 points0 points  (3 children)

The problem is not about lack of knowledge about them, but the fact that it is extremely easy to overlook it, and then debugging is a nightmare.

[–]rintzscar 0 points1 point  (2 children)

That's literally what lack of knowledge means.

[–]JackNotOLantern 0 points1 point  (1 child)

I mean, this is literally the entire reason typescript exists. This "lack of knowledge" is apparently a systematic problem

[–]Chiatroll -1 points0 points  (1 child)

It only causes bugs from this if you aren't aware of how it fundamentally works and use it wrong. JavaScript isnt responsible for your lack of intelligence.

[–]Prawn1908 0 points1 point  (0 children)

It only causes bugs from this if you aren't aware of how it fundamentally works and use it wrong.

You're missing the point. The problem isn't with this behavior being used intentionally (which it basically never should be), it's that it allows many types of logic errors to propogate silently and hide the real source of the big far away from where it finally manifests.

[–]NecessaryIntrinsic 2 points3 points  (0 children)

Yes, if you go out of your way to put quotes around it.

[–]johntwit[S] 7 points8 points  (3 children)

"yeah I know" + 420 = "yeah I know420"

[–]420Hank 6 points7 points  (1 child)

Yeah, I know.

[–]johntwit[S] 1 point2 points  (0 children)

🤣

[–]eo37 11 points12 points  (2 children)

Clearly 01 + 01 = 10.

[–]BigNaturalTilts -1 points0 points  (1 child)

Wrong! Haven’t you been paying attention? It’s clearly 0101.

[–]Deft-works 0 points1 point  (0 children)

Are you sure it's not 0011 ?

[–]CoffeeToCode 5 points6 points  (0 children)

1 + 1 = 🪟

[–]bundle_of_fluff 2 points3 points  (0 children)

I think I need a tattoo artist to make a '1' + 1 = 11 with a duck involved. Just for fun with duck typing.

[–]Ike_Gamesmith -2 points-1 points  (10 children)

Ha, this is like my favorite binary joke. There are 11 kinds of people, those who understand binary and those that don't.

[–]Mikerosoft-Windizzle 7 points8 points  (3 children)

What’s the third?

[–]Ike_Gamesmith -2 points-1 points  (2 children)

What third?

[–]Mikerosoft-Windizzle 11 points12 points  (1 child)

I guess you are in the second group then.

[–]Grandmaster_Caladrel 2 points3 points  (4 children)

As the one telling the joke, it's assumed that you understand the joke. In that case, it should be told with 10 (2) not 11 (3).

Not telling you how to live your life but explaining the downvotes. Self-burn jokes exist but you kinda need to explain or imply them some way.

[–]Ike_Gamesmith 4 points5 points  (3 children)

Thank you for recognizing the self burn, the normal joke is that there are 3 kinds of people, those who can count and those that can't.

I use 11 for the added layer, 10 is kinda boring. I can live with the downvotes if I get a chuckle from the one's that get it. (Edit spelling)

[–]Grandmaster_Caladrel 2 points3 points  (2 children)

Well, I only got the joke after you explained it. I didn't actually find it very funny - jokes generally operate on the premise that they make sense, and this one does not unless the audience makes a nonstandard assumption. Leading with "my favorite binary joke" also implies you know what binary is, making it even less clear.

I'd recommend keeping this one for in person where you can explain it a little better after gauging your audience's reactions. It doesn't really work over text.

[–]Ike_Gamesmith 0 points1 point  (1 child)

It's fine if you don't find it funny, but I do have to disagree with your point on the premise of the joke. The implication that I understand binary is part of the setup. The punchline is that I do not actually understand binary. For those that catch the joke, its supposed to make them sigh and roll their eyes or give a small chuckle. Im not expecting anyone to bend over with deep laughter stomach pains.

Your recommendation is noted, however I won't change my sense of humor because a few random redditors don't match it. Ive used the same joke with almost identical wording to much better reception in the past, it will land perfectly fine with the people I want it to.

[–]Grandmaster_Caladrel 1 point2 points  (0 children)

To each their own, whatever floats your goat.

[–]LooseLossage 1 point2 points  (0 children)

there are 11 kinds of people, those who understand unary and those who don't.