• Shanmugha@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    8 days ago

    And I can’t take this one. I did not ask if an object referenced by a is the same object referenced by b, I asked if two empty collections of values are equal. And an empty bag can easily be substituted by another empty bag, there is no class/instance tricky business here. And the fact that in JS arrays are objects is again JS-specific insanity. Still I thank you for sharing your thoughts

    • Phoenixz@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      7 days ago

      Well it’s what you’d want but not what it does, for one, but for another: comparing scalars is very easy, comparing complex structures is not. To compare one array with another you’d need to iterate over each element, recursively.

      That JavaScript handles arrays as objects is also not bad, that’s just a language feature that you may like or not, not much can go wrong there. The reassignment of “this” or how JS handlesnumber comparison, yeah, that is infuriatingly bad