I guess isn't Javascript's == operator supposed to be an "is this the same stuff in the box" check? There's all this implicit typecasting going on, but at its heart, it's an equality check designed to determine if two variables contain the same value. So I'm not sure you can draw the conclusion of philosophical differences in language design when Javascript has an operator with the same intent as in Ruby.
Hi Tim, good point! However, if you try out [1,2,3] == [1,2,3] in your console, you'll see it returns false. JS's double-equals will coerce types, but it won't perform a recursive equality check the way it does in Ruby. 😵
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I guess isn't Javascript's == operator supposed to be an "is this the same stuff in the box" check? There's all this implicit typecasting going on, but at its heart, it's an equality check designed to determine if two variables contain the same value. So I'm not sure you can draw the conclusion of philosophical differences in language design when Javascript has an operator with the same intent as in Ruby.
Hi Tim, good point! However, if you try out
[1,2,3] == [1,2,3]
in your console, you'll see it returnsfalse
. JS's double-equals will coerce types, but it won't perform a recursive equality check the way it does in Ruby. 😵