On Saturday, 7 May 2011 21:15:15 UTC-3, nathanJsweet wrote: > > Hey JR, > Just wanted to confirm what others are saying. It returned 1 for me as > well. I also tried this: > Array.prototype.indexOf.call([0, false, 15] , false); > and it also returned 1 (though why wouldn't it, if the other one did). > I'm really interested to see you solve this mystery though, because I can > see any obvious way you could have made a mistake. Best of luck. > -Nate > > On Sat, May 7, 2011 at 4:42 PM, Lasse Reichstein <[email protected]>wrote: > >> On Sun, 08 May 2011 00:20:35 +0200, J.R. <[email protected]> wrote: >> >> After scratching my head for a while, I've found a bug in Google Chrome >>> (latest version 11): >>> >>> [0, false, 15].indexOf(false); // should return 1, but it returns 0; >>> >> >> I'm unable to reproduce this. Can you say a little more about what >> you are doing, and how you execute the code above? >> >> I've just installed Chrome 11.0.696.65 (Linux) and when I execute >> >> [0,false,15].indexOf(false) >> it evaluates to 1. >> Ditto in version 12.0.742.30 dev-m (Windows), and also in the old >> version 9 I had on Linux before I updated it. >> >> >> In Firefox 4, the test above returns 1 (the correct result). >>> >>> I guess Google Chrome is testing the array for the searchElement >>> existence >>> using the '==' operator instead of the Strict Equals Operator (===). >>> Therefore, Chrome is not compliant with ECMA-262 5th ed., 15.4.4.14. >>> >> >> Not according to the source code, and it hasn't changed recently. ;) >> >> Well, I was having a mysterious problem with indexOf returning a wrong value. After testing with FF4, I decided to go back to Chrome's console (Ctrl + Shift + J) and typed
[0, false, 15].indexOf(false); // console returned 0 instead of 1. Now, I've just updated my Google Chrome to 11.0.696.65 version and ta-da... my code began to work correctly. It's really weird because I didn't change anything in my code. It seems to me that the older version (prior to 11.0.696.65) had that bug in Array.Prototype.indexOf(). Seems like a bug also discovered by the Chrome team and rapidly corrected. Many thanks to everyone that has tested the problem. Cheers, João Rodrigues (JR) -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
