1
Vote

Array indexOf test will always be false

description

I came across an issue where an indexOf condition was coming false.

I then noticed this line in JsArrayConstructor

StrictlyEquals(Global, result, searchParameter) == Global.BooleanClass.True

After digging a little bit more into StrictlyEquals I then noticed
        else if (left.Type == JsInstance.TYPE_STRING)
        {
            return global.BooleanClass.New(left.ToString() == right.ToString());
        }
        else if (left.Type == JsInstance.TYPE_BOOLEAN)
        {
            return global.BooleanClass.New(left.ToBoolean() == right.ToBoolean());
        }
Because of this it is creating a new instance for boolean which will ways make StrictlyEqual false.

Here is the fix.

StrictlyEquals(Global, result, searchParameter).ToBoolean() == Global.BooleanClass.True.ToBoolean()

comments