Permalink
Browse files

Fix bug `indexOf`. when arr is number, it was return 0

  • Loading branch information...
hokaccha committed Jan 25, 2012
1 parent d998ecd commit 460925c2c65af3ba25bff4cfaacfc9f3bfd603b9
Showing with 4 additions and 0 deletions.
  1. +4 −0 expect.js
View
@@ -449,6 +449,10 @@
return Array.prototype.indexOf.call(arr, o, i);
}
+ if (arr.length === undefined) {
+ return -1;
+ }
+
for (var j = arr.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0
; i < j && arr[i] !== o; i++);

0 comments on commit 460925c

Please sign in to comment.