I got an array (see below for one object in the array) that I need to sort by firstname using JavaScript. How can I do it?
var user = { bio: null, emai
underscorejs offers the very nice _.sortBy function:
_.sortBy([{a:1},{a:3},{a:2}], "a")
or you can use a custom sort function:
_.sortBy([{a:"b"},{a:"c"},{a:"a"}], function(i) {return i.a.toLowerCase()})