Yes, but one day you'll have to look at somebody else's code, and they're going to do shit you don't do, and you're going to be wondering what the hell is going on there. Or worse, it'll look like it's doing one thing, but really be doing something else, because of some subtlety of syntax.
In chrome I also get false, so it's not even correct.
That's the other problem, that it doesn't behave the same way in every browser, which makes it that much more difficult to write Js that actually works everywhere as expected.
This has nothing to do with value and reference types
No? I was responding to the assertion that [] === [] -> false is unintuitive/incorrect, when actually it is correct since it performs reference evaluation. Do the same with a value type and you'll see it perform as expected.
5
u/yogthos May 09 '12
Yes, but one day you'll have to look at somebody else's code, and they're going to do shit you don't do, and you're going to be wondering what the hell is going on there. Or worse, it'll look like it's doing one thing, but really be doing something else, because of some subtlety of syntax.
That's the other problem, that it doesn't behave the same way in every browser, which makes it that much more difficult to write Js that actually works everywhere as expected.