PHP is worse. I can use JS and be perfectly happy (although I do prefer Ruby). Sure some things are a bit wordy (hello, Mr. hasOwnProperty), but it's really not too bad. PHP on the other hand is a blight of bugs and bad surprises.
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.
That's the other problem, that it doesn't behave the same way in every browser
I tried your code in opera, firefox, safari, chrome, IE 9, IE 8, IE 7, IE 6 and even IE 5.5, and all yield the same result: false. Where does it work differently?
Outside my code, I've also never seen anyone else do '[] === []' in 10 years of programming, but even then, false is exactly what it should and does return.
global variables, function scope, this binding, new constructor, arrays indices as string, for in ordering, and so on. JavaScript: The Good Parts explains this quite well.
21
u/[deleted] May 09 '12
Old, and wouldn't this be true of every language?