r/ProgrammerHumor • • Mar 20 '24

Meme areJSDevsActuallySane

Post image
14k Upvotes

554 comments sorted by

View all comments

3.1k

u/Ambitious-Finance-83 Mar 20 '24

can't wait for this to come up in an interview...

837

u/Confident-Ad5665 Mar 20 '24

If you're English you should know it doesn't work with "mum"

270

u/uday_it_is Mar 20 '24

But “pop” will work?

56

u/Exaskryz Mar 20 '24

So would jig, bip, freckles.

29

u/theunquenchedservant Mar 21 '24

are these things the british people call their parents?

15

u/grlap Mar 21 '24

No, but neither is pop. That is a verb.

24

u/theunquenchedservant Mar 21 '24 edited Mar 21 '24

Pop is absolutely something British people (and American people) call their dad.

Edit: okay I was wrong about it's prevelance in the UK.

9

u/OhmicFoamy Mar 21 '24

Not in England

→ More replies (3)
→ More replies (2)
→ More replies (1)

0

u/[deleted] Mar 20 '24

[deleted] — view deleted comment

30

u/the-liquidian Mar 20 '24

The square bracket is not typed, the {} object gets converted into a string representation which is [object Object]. These square brackets then have regex meaning, match anything inside of them. The o matches Mom, there is nothing in the brackets that match Dad.

→ More replies (1)

103

u/iridescenttriangles Mar 20 '24

Yeah, you'd likely ((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]).toUpperCase().

75

u/Trappist-1ball Mar 20 '24

for those who are wondering

((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]).toUpperCase() // "FAIL"
→ More replies (1)

50

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

43

u/iridescenttriangles Mar 20 '24

When you're used to JS it's as straightorward and natural as parseInt(Number.MIN_VALUE) being 5

31

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

33

u/iridescenttriangles Mar 20 '24

parseInt with arity 1 interprets its argument as a string representing a base-ten int and stops parsing when it encounters the first character that doesn't make sense for that. Numbers are doubles/float64s, Number.MIN_VALUE gives you the smallest positive value representable by that which is 5e-324. parseInt stops parsing that with the e.

parseInt with arity 2 takes the base as the second argument, you can do convenient things like parseInt(parseInt, 35) which is 1021464698788.

41

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

39

u/Salanmander Mar 21 '24

Every "javascript is weird" behavior comes from its philosophy of "programs should never, ever crash". And I will always maintain that that is a bad philosophy.

6

u/ArtOfWarfare Mar 21 '24

That’s not even true though. If I write false+[], that returns ”false”. But if I write false***[], that’s a parse error.

So I can write programs that “crash” in JavaScript - the question more is, why doesn’t false+[] do the saner thing of just throwing an error/exception? JavaScript’s rule of coercing any operand involved with addition to a String UNLESS every operand is a number doesn’t really make much sense at all…

9

u/swishbothways Mar 21 '24

Tsk tsk. It didn't technically crash. It just didn't parse. Never said anything about a philosophy that code shouldn't ever not parse.

→ More replies (1)
→ More replies (4)

11

u/JonDum Mar 21 '24

That's actually super impressive that it can break it down and analyze it like that...

It's equally hilarious that it still got it wrong.

19

u/OliviaPG1 Mar 21 '24

Because it’s not breaking down and analyzing it. It’s just producing text that looks as similar as possible to what text of someone breaking it down and analyzing it would look like.

10

u/Disastrous-Team-6431 Mar 21 '24

The best formulation of this concept ive heard. It's insane that "producing text that looks like code that does what you asked" or "producing text that looks like debugging your code" will do those things.

→ More replies (1)
→ More replies (7)
→ More replies (3)
→ More replies (4)
→ More replies (1)

34

u/al-mongus-bin-susar Mar 20 '24

This isn't useful in any situation except shitposts and some old type checking code so probably not.

19

u/[deleted] Mar 20 '24

I think they were joking.

→ More replies (4)
→ More replies (2)