I'm just going to drop this here and run away 🏃

  • 6
    oh boy another one, eh? Just what everybody wanted.
  • 2
    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.
  • 3
    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.
  • 3
    @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"
  • 3
    Now 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.
  • 1
    js 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.
  • 0
    Most programmers make a few of those mistakes once or never and move on with life
Add Comment