all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
var arr = [
|
||||
{id: 3, value: "foo"},
|
||||
{id: 2, value: "bar"},
|
||||
{id: 4, value: "baz"},
|
||||
{id: 1, value: 42},
|
||||
{id: 5, something: "another string"} // Works with any object declaring 'id' as a number.
|
||||
];
|
||||
arr = arr.sort(function(a, b) {return a.id - b.id}); // Sort with comparator checking the id.
|
||||
Loading…
Add table
Add a link
Reference in a new issue