Closed Bug 1343142 Opened 9 years ago Closed 5 years ago

Clarify that Array.prototype.sort() sorts in increasing order

Categories

(Developer Documentation Graveyard :: JavaScript, defect, P5)

All
Other
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jan, Unassigned)

References

()

Details

:: Developer Documentation Request Request Type: Correction Gecko Version: unspecified Technical Contact: :: Details Yes, if 'apples' comes before 'bananas' we deduce that it's sorted in increasing order, but it should be stated upfront, e.g.: "The sort() method sorts the elements of an array in place and returns the array sorted in increasing order." It would be really nice to have an example how to sort in decreasing order, e.g.: function compareForDecsendingOrder(a, b) { if (a < b) return 1 else return -1; }

Hi Jan, I have edited the docs to point out that the default sorting order is ascending. I think the rest has already been taken care of.

MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.