r/ProgrammerHumor • • Oct 29 '26

Meme magicQuotes

Post image
2.4k Upvotes

77 comments sorted by

View all comments

67

u/gburri Oct 29 '26

Why just not prevent Rasmus Lerdorf creating this monstrosity?

71

u/ustp Oct 29 '26

You would like to use JS instead?

0 == "0" //true
0 == []  //true
"0" == []//false

40

u/Foorinick Oct 29 '26

In what situation would you be doing that

98

u/MyAntichrist Oct 29 '26

When you wanna prove a point on how shit JS is, duh.

25

u/ChaseShiny Oct 29 '26

Yeah, that's r/firstWeekProgrammerHumor stuff. We probably should mention something like console.log doesn't actually create a log (with timestamps and such).

3

u/arsenicx2 29d ago

You know I never thought about the fact they called a print statment console.log I just accepted it.

→ More replies (1)

6

u/fghjconner Oct 29 '26

When some api returns a value with a different type than you expect.

4

u/Foorinick Oct 29 '26

Can't you just check if the type is what you want beforehand? Or just... Yk... ===

20

u/tankerkiller125real Oct 29 '26

"Truthy" shouldn't be a thing in any programming language. The fact that Javascript is not just truthy, but inconsistent at best with it is wild. And even more wild is people decided that it was a language they wanted to use in backend infrastructure.

18

u/aabil11 Oct 29 '26

The language was created in a day and the only reason the creator named it that is because Java was popular at the time. And now the entire internet runs on it

6

u/NotADamsel Oct 29 '26

Any language where writing shit like “if foo == True:” is a good idea should be ashamed of itself.

2

u/WithersChat Oct 30 '26

Not quite that, but the weak typing will one day be the death of me.

WHAT DO YOU MEAN YOU ARE COEECING MY ENUM INTO A NUMBER? I LITERALLY OVERLOADED THIS EXACT METHOD TO WORK WITH AN ENUM!

12

u/NiIly00 Oct 29 '26

Typescript makes it bearable.

11

u/illepic Oct 29 '26

TS and my linters would actually slap me in the face for any use of a loose equality operator. It might even put me in a corner for a timeout.

5

u/Foorinick Oct 29 '26

Just make it connect to a shock collar for quicker feedback and longer lesson reminding smh my head 

2

u/Loading_M_ Oct 29 '26

Iirc, most linters explicitly allow loose equality for checking null/undefined, since loose equality checks both.

2

u/illepic Oct 30 '26

All linters "allow" anything. It's just a matter of what your config allows. I haven't seen an eslint config used for real that allows loose equality.

→ More replies (1)

6

u/00pflaume Oct 30 '26

And that is why god gave use strictly equal.

Praise the lord and his ===

4

u/gburri Oct 29 '26

Sure not, JS is also a monstrosity. Maybe create a nice Python web framework instead (Python was created four years before PHP) or a simple well-designed typed language like Gleam.
PHP was successfully at that time because it was easy to use with Apache and was specifically designed for web.

10

u/ustp Oct 29 '26

I used python for two years at work... It's nice language, but whitespace hell disqualifies it.

4

u/WithersChat Oct 30 '26

Semantic whitespaces like in python should be a human rights violation.

7

u/Tathas Oct 29 '26

Are you suggesting using python for browser scripting?

1

u/Majik_Sheff 28d ago

Saying PHP was designed is like calling Kowloon Walled City architected.

5

u/addyftw1 Oct 29 '26

To quote famed reverse engineer Lenny Zeltser, "JavaScript is an abomination."

1

u/GodsBoss 29d ago

Great, now the web runs on Perl instead.

Personal note: I had the great opportunity to work with Perl for a project and I can confidently say that I did not expect it to be worse than PHP. It was.