Closed Bug 554315 Opened 16 years ago Closed 16 years ago

Array.sort doesn't work with strings as keys

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: thomas, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.8) Gecko/20100214 Ubuntu/9.10 (karmic) Firefox/3.5 Build Identifier: Mozilla Fennec 1.1a2pre Method Array.sort doesn't work using strings as keys, with and without a function given in parameter for the method sort Reproducible: Always Actual Results: The Array is not sorted, (function return immediately?) Used when programming a Fennec extension
> Method Array.sort doesn't work using strings as keys javascript:alert(["foo", "bar", "something"].sort()) works fine for me. Please give actual steps to reproduce this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INCOMPLETE
var array = new Array(); array["feel"] = "lles"; array["abim"] = "io"; array["meee"] = "amour"; alert(array.sort()); I use string as key in state of integers. In your test, you didn't.
Resolution: INCOMPLETE → FIXED
In that case, invalid. The spec clearly defines sort() to work only on the properties of the array whose names are integers.
Resolution: FIXED → INVALID
You need to log in before you can comment on or make changes to this bug.