I have an array that looks like this:
var arr = [
{name: 'Price'},
{name: 'Sale'},
{name: 'Shipping'},
{name: 'Customer Rating'}
]
Is there a way to sort this array so that a specific item is at a given index? For example, I always want 'Customer Rating' to be at index 1.
var arr = [
{name: 'Price'},
{name: 'Customer Rating'}
{name: 'Sale'},
{name: 'Shipping'}
]
Bonus points for es6 one liner solutions!