Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Just never use the equality operator, remember, that all numbers are floats and that the most mathematical implementation of min and max is to have an initial value of -/+ infinity.
We can agree on that most of the implicit type conversations should be errors instead.
JavaScript with all it's flaws is still a quite good language for the occasional client side scripting. -
Most of these (highly reposted) things are just a deliberate use of valid mechanics to get weird results.
The only one I find funny is typeof NaN. It makes sense, but still kinda gets me. -
theuser48025y@AlgoRythm and it doesn't get better if you don't know how the type coercion system works. The statement (! + [] + [] + ![]) simply equals the string "truefalse" and whaddaya know, the length is 9.
> ! + [] = true
> true + [] == "true"
> "true" + ![] = false
> "true" + false == "truefalse" -
C0D4681385yNow for all the ones you are -using-... I mean abusing type coercion for, show me a valid use case that you are dumb enough to implement these with.
I'm waiting for the day someone actually uses "(!+[]+[]+[])" and expects a valid response.
Just because a language "can" do something, doesn't mean you as the dev "should" do it.
I mean, in simpler terms....
I "can" drive a car off a cliff into a valley of ass raping gorilla's, doesn't mean I "should"... unless you're into that that?, stop blaming the car. -
hashit11305yjs will most likely be hated by backend devs who rely more on logic , consistency and stability ..and loved by frontend devs who spend 4 hours deciding the colour of a button.
I'm just going to drop this here and run away 🏃
joke/meme
types
javascript