const array = [ { name: 'apple', price: 1.2 }, { name: 'banana', price: 0.9 }, { name: 'orange', price: 1.0 } ]; array.sort((a, b) => a.price - b.price); console.log(array); // 输出 [{"name":"banana","price":0.9},{"name":"orange","price":1},{"name":"apple","price":1.2}]