const arr = [ {name: 'John', age: 30}, {name: 'Mary', age: 25}, {name: 'Bob', age: 35} ]; const order = ['Bob', 'Mary', 'John']; const sortedArr = arr.sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name)); console.log(sortedArr); // [{name: "Bob", age: 35}, {name: "Mary", age: 25}, {name: "John", age: 30}]