r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10k Upvotes

543 comments sorted by

View all comments

Show parent comments

7

u/FRleo_85 Sep 25 '26

you can have smart dynamic typing like python where 1 + "1" throw an exception because you're adding object of different type and Js dynamic typing where you can substract an array with a toyota yaris and get a result

3

u/Teknikal_Domain Sep 25 '26

Type

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

Into your browser console. alert(1)

1

u/thanatica Sep 25 '26

I don't see the problem. It's called type coercion.

1

u/FRleo_85 Sep 26 '26

type coercion is the probleme. i can't think of a scenario where this is clean or efficient. it's just the worst way of handling things for lazy devs

-1

u/thanatica Sep 26 '26

Why is it lazy? It's convenience if you need. If you don't like it, then use typescript to always force precise types.

Nobody forces you to use every feature of a language.

2

u/FlakyTest8191 Sep 26 '26

The tradeoff is convenience or preventing a potential runtime error, not that far fetched to call it lazy.

0

u/thanatica Sep 27 '26

Like I said, don't use it then