Reputation: 539
I have an array that look like this
var array = [{id:5},{id:1},{id:2}]
I want to rearrange the array index based on the id value from lowest to highest so it becomes
var newarray = [{id:1},{id:2},{id:5}]
I have been looking at sort() but I dont quite understand the logic behind it.
Upvotes: 0
Views: 58