Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla

Compare Revisions

Array.prototype.sort()

Change Revisions

Revision 429851:

Revision 429851 by dbruant on

Revision 436213:

Revision 436213 by nebulon on

Title:
Array.prototype.sort
Array.prototype.sort
Slug:
Web/JavaScript/Reference/Global_Objects/Array/sort
Web/JavaScript/Reference/Global_Objects/Array/sort
Tags:
"Array", "Array methods"
"Array", "Array methods"
Content:

Revision 429851
Revision 436213
t97    return a.name > b.name;t97    if (a.name > b.name) {
98      return 1;
99    } else if (a.name < b.name) {
100      return -1;
101    } else {
102      return 0;
103    }

Back to History