Is apple a fruit? Yes.
Is orange a fruit? Yes.
Is apple an orange? No.

Does apple equal a fruit? No.
Does orange equal a fruit? No.

If you're capable of understanding this, then WHY IS IT IT SO DAMN HARD TO UNDERSTAND 0 == ""?

  • 2
    Reading the manual helps.

    "If Type(x) is Number and Type(y) is String,
    return the result of the comparison x == ToNumber(y)."

  • 4
    Here, have a cookie 🍪,
    You've earned it!
  • 4
    But did you know that chilli pepper is a fruit
  • 4
    Is apple instance of fruit? Yep.
  • 1
    @melezorus34 That's where you may be wrong good sir. The actual fruit of an apple is the apple core.
  • 1
    Class chains apply on instanceof 😛
  • 1
    @melezorus34 Indeed, an Accessory Fruit does not know about seeds so it cannot be a subclass of Fruit, but the instanceOf still works. We have proven that JS is not class oriented then.
  • 1
    @sudocode Is cookie a fruit? Or has OP lied to me?
  • 2
    @Jilano A cookie is just an orange with chocolate chips.

    See for yourself: 🍪

    ( Undeniable proof, whoever disagrees can see me in court)
  • 6
    Is mayonnaise an instrument?
  • 2
    @sudocode That does look like a solid proof. Thank you

    Can I still see you in court, though? It's been a while since we've hang out...

    @maces That goes without saying
  • 1
    "is a" is not the same as "equals to".
    It looks like your example is just confirming the wrongness of JS.
  • 0
    @Lensflare You mean like the is operator in C#? That would be typeof in js.
  • 1
    @Jilano Absolutely my dude! I'll be the one wearing a pink PPE.
  • 1
    @theuser C# does also have typeof() 🙂
  • 1
    Think I get what you're trying to convey, but == is wrong as a comparison operator.

    defining, mathematically, how null, 0, "", [], {} and other empty types are exactly empty other than just saying "they just are", is difficult.

    Or read this 1980 paper, a foundational work on type theory around implicit conversions in imperative languages: http://cs.cmu.edu/afs/cs/...

    Isn't type theory fun?

    Anyway, my glass of cognac ∈ ⊥

    Wait no, that's impossible, something can't be part of nothing.

    Anyway, I'm ∈ drunk people, so my brain is ⊥
  • 1
    @sudocode *high five from afar to respect the distanciation guidelines*
Add Comment