var sortOrder = [2,3,1,4], items = [{id: 1}, {id: 2}, {id: 3}, {id: 4}]; items.sort(function (a, b) { return sortOrder.indexOf(a.id) - sortOrder.indexOf(b.id); });