Status

Developer Documentation
JavaScript
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: imphil, Assigned: rwaldron)

Tracking

Details

(Reporter)

Description

4 years ago
I got a mail from a contributor regarding the polyfill of Array.indexOf(), as documented here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf

I quote from his mail:

"use this testcase in IE8: 

var indexOf1 = [0, 1, 2, 3]; 
delete indexOf1[1]; 
delete indexOf1[3]; 
indexOf1.indexOf(undefined);  // ==> 1, but i think the right result is -1 

in the polyfill panel, should be add the condition "fromIndex in this"
like this:

for (; fromIndex < length; fromIndex++) {
  if (this[fromIndex] === searchElement && fromIndex in this) {
    return fromIndex;  }}
"

I don't know if there really is a problem in the polyfill, could some JS hacker have a look at that?
(Assignee)

Updated

4 years ago
Assignee: fscholz → waldron.rick
(Assignee)

Comment 1

4 years ago
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf$revision/640485
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
(Reporter)

Comment 2

4 years ago
Rick, thanks! Unfortunately the formatting got badly broken in MDN and I cannot really recover your original meaning, could you have a look at it again?
You need to log in before you can comment on or make changes to this bug.