Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Sort based on keys
//nodejs v4.2.6 var arr = [{id: 588, name: "1 ex"}, {id: 592, name: "11 ex"}, {id: 607, name: "2 ex"}, {id: 580, name: "3 ex"}, {id: 596, name: "4 ex"}]; var map = {} for(var item of arr) { map[item["name"]] = item; } var arr = arr.map(function(item){return item["name"]}).sort(function(a, b){ var a = parseInt(a.split(' ')[0]); var b = parseInt(b.split(' ')[0]); return a-b; }).map(function(name){ return map[name]; }) console.log(arr);
run
|
edit
|
history
|
help
0
Get stack from error
Funny stuff
AVL-GO-FLAT
RFID TEST
Lowertoupper
Include object in a query string
lodash
Compare 2 arrays and fill 1 or 2
Count digits
To compare; creating async methods in javascript