On Sep 3, 1:56 am, enigment wrote:
> Hmmm, even outside the indexOf() question, this is a bit creepy to me.
> I hadn't previously tested, but these are all true, at least in
> Firefox 3.5 and IE8:
[...]
> new String("mpg") !== new String("mpg")
> new String("mpg") != new String(
I (Mojito) [don't know why my first post name differs from reply name]
have solved by issue. I was passing in strings with '\0' on their
ends. So 'mpg\0' does not equal 'mpg'. It was a nightmare to debug
because '\0' is invisible.
On Sep 2, 10:29 am, enigment wrote:
> Ah, that's the missing p
Ah, that's the missing piece, the difference between a string
primitive and a string object. Got it.
e
On Sep 2, 12:17 pm, "T.J. Crowder" wrote:
> There's a difference between primitives ("mpg") and objects (new String
> ("mpg")).
--~--~-~--~~~---~--~~
You receiv
Hmmm, even outside the indexOf() question, this is a bit creepy to me.
I hadn't previously tested, but these are all true, at least in
Firefox 3.5 and IE8:
"mpg" === "mpg"
"mpg" !== new String("mpg")
new String("mpg") !== new String("mpg")
new String("mpg") != new S
Hi,
There's a difference between primitives ("mpg") and objects (new String
("mpg")). The == operator allows for a *lot* of type coercion; the ===
operator is _supposed_ to be a strict equality operator including type
and so "mpg" !== new String("mpg") because they're different types.
See section
Hi,
You're probably running into equality vs. identity (loose equality vs.
strict equality). The emerging standard for what Array#indexOf is
supposed to do uses strict equality (===), not ==, whereas previously
Prototype used loose equality. This is an issue with strings because
"mpg" !==