sort objects in an array code example Example: sort objects in an array cars.sort(function(a, b){return a.year - b.year});