New issue
Advanced search Search tips
Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue v8:90
Owner: ----
Closed: Aug 2016
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Sign in to add a comment

Incorrect result of works "Array.prototype.sort" function

Reported by, Jul 28 2016 Back to list

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

Steps to reproduce the problem:

  var testArray = [];
  for(var i=0; i<11; i++){



Result in Chrome:

  0 5
  5 1

Result in Firefox:

  0 5
  0 5

What is the expected behavior?
All array elements are compared as strings "[object Object]". Consequently their location in the array does not change.

What went wrong?
Why swap the elements at indices '1' and 'Math.floor(testArray.length/2)'

Did this work before? No 

Chrome version: 51.0.2704.103  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:

Comment 1 by, Jul 29 2016

Components: -Blink Infra>Client>V8
Labels: -OS-Windows OS-All
Status: Untriaged
Confirmed in Canary. Edge produces the same result as Firefox.
Components: -Infra>Client>V8 Blink>JavaScript
Better triage label...
Components: -Blink>JavaScript Blink>JavaScript>Language
Status: Available

Comment 4 by, Aug 10 2016

Mergedinto: v8:90
Status: Duplicate
This is working as intended: sort is not guaranteed to be stable (see various historical discussion on  issue v8:90 ).

Sign in to add a comment