Array#indexOf and Array#lastIndexOf question

# John-David Dalton (16 years ago)

I noticed that most Array methods perform [[HasProperty]] checks on the index values. Array#indexOf and Array#lastIndexOf do not. Firefox 3, Safari 4, Chrome 2 all seem to check [[HasProperty]] for Array#indexOf and lastIndexOf.

Is this an oversight on the draft or did the browser vendors miss something ?

  • John-David Dalton
# Brendan Eich (16 years ago)

On Jun 14, 2009, at 8:24 PM, John-David Dalton wrote:

I noticed that most Array methods perform [[HasProperty]] checks on the index values. Array#indexOf and Array#lastIndexOf do not. Firefox 3, Safari 4, Chrome 2 all seem to check [[HasProperty]] for Array#indexOf and lastIndexOf.

Is this an oversight on the draft or did the browser vendors miss
something ?

Browser implementations, starting with Firerfox 1.5 / SpiderMonkey
(JS1.6), preceded the spec, so the oversight is probably on TC39's
part. I don't recall this coming up and a rationale for diverging from
the de-facto standard being given.

# Allen Wirfs-Brock (16 years ago)

Agreed...I'll fix it.