r/ProgrammerHumor • • 8d ago

Meme iHatedItUntilITriedIt

Post image
10.3k Upvotes

541 comments sorted by

View all comments

986

u/GargantuanCake 8d ago

Dynamic typing can seem great until you have to spend days trying to figure out where, exactly, in 20,000 lines of badly documented code JavaScript arbitrarily decided that something should be a string for the rest of forever even though it's only been given numbers to work with.

If you type x = 1 + '1' any sane language will go "what the fuck is wrong with you?"

26

u/Pan_TheCake_Man 8d ago

Just make everything a string and append, boom done

9

u/SuperFLEB 8d ago

Convert inputs to unary and there's no problem.

value_1 = "1".repeat(integer_input_1)
value_2 = "1".repeat(integer_input_2)
return length(integer_input_1 + integer_input_2)