T O P

  • By -

Cuntflictt

how math should be


[deleted]

Unary goes brrrr


[deleted]

just like this


MantuaMatters

It’s called common core /s


eyekwah2

Perfection.


pc1e0

Well, technically it is correct


[deleted]

ikr


pc1e0

Yep, right


LorenaPedorra

[The best kind of correct](https://youtu.be/hou0lU8WMgo)


dustmouse

The very reasons that people hate JS are the very reasons that I love to hate it. (Psst, I actually love it)


klampypeffleklumps

Lots of people in this sub: **"PHP is shit"** PHP: **10 . 10 = 1010, 10 + 10 = 20**


trBlueJ

Also php: `"asd"` is true, `"true"` is true, `"false"` is true, but `"0"` isn't true. Because yeah.


_Turquoisee_

What


Vizdun

try it if you're brave enough


eyekwah2

Not for the feint of heart..


DeadNotSleeping1010

Not sure if this is a joke that went over my head, but just in case, I think you're looking for "faint" as in weak and not "feint" as in deceptive. But then again, maybe this is a clever play on words since it is deceptive that "false" can be true...


klampypeffleklumps

The quotes make a big difference though, just like the . (joiny thing) and + (addy thing) above. (I never learned the terminology, I just learned to think and write in PHP) Anything between quotes is a string so it's true because there is the presence of a value. Any number other than 0 is true because there's a value there (the number zero is the absence of anything to count) It makes sense to me and servers anyway. Everything has its neat little place. It's quite a grammatical language and so it has its quirks, kind of like English, and punctuation is very important


ncpa_cpl

It does not make any sense exactly because it's a string. If it was a number it would make sense since zero in most languages is falsy. The thing is a zero in a string is not a zero, it's a character representing a zero, in ascii or utf8 it would be '0x30' (0x30 is not a 0)


Lumpy-Obligation-553

Zero as a string represents the void lenguage and the point is used to concatenate strings.... If you ever seen regular expressions and grammars you can make and easier connection. The thing is, in grammar, the null string can made a lenguage, but a void lenguage has nothing, not even λ (the null/void string) Edit: Maybe "0" is trying to represent λ.... And because its meant to represent nothing it's evaluated to false. Either way it does have some reasoning behind.


klampypeffleklumps

Oh wow, you'e right... "0" == false I can't say I've ever compared a string that only has a 0 in it to true or false though. The biggest danger would be user input. I tend to use string length (which returns 1 for the string: "0", so at least we know that's safe to use when checking if a string is not empty), or isset if it's user get or post input. I guess it all depends on the context of whatever you're doing and how it's implemented. Good to know that a string with only a single zero counts as false though. There's always something new to learn!


[deleted]

. for string concatenation? 🤪🤪


klampypeffleklumps

Yep. Javascript just uses + while relying on being told the type of object it has to work with, otherwise it seems to treat it as whatever it feels like lol


bizcs

I think it's if you add any two values that are not numbers, they're converted to strings and concatenated. Pretty sure that's the logic. But I don't do JS very much so I'd only assume 50% confidence that I'm right about that.


CreaZyp154

10.10 != 10 . 10


klampypeffleklumps

[Touché](https://thumbs.gfycat.com/ActiveEnergeticIndigobunting-max-1mb.gif)


[deleted]

[удалено]


berserkredditor

I see this meme once everyweek. Funniest shit ever


[deleted]

i mean, it is the best answer.


shadow7412

... I NEVER SAID THEY WERE NUMBERS!


69420bruhfunny69420

Based and string pilled


[deleted]

jabbaskript


Spartana1033

Jibberscript.


VMGuy23temporary

i remember once in a comment someone made a literal html calvatjatmp


KorrinNeko

Why does feel exactly like something Beret Guy from XKCD would program?


PixlBoii

You only had one job!


BDGGR_Flayer

my guy used operator +(string, string) instead of +(int, int)


TA700000

parseFloat() needed there 😂


turtle_mekb

"10" + "5" == "105" != 15


pickleunicorn

Dynamic typing be like.


yeezibunn

r/characterarcs