From 31884669672e351f9a33f9b56a4db5c1639338b4 Mon Sep 17 00:00:00 2001 From: Vse Mozhe Buty Date: Sat, 10 Oct 2020 21:22:06 +0300 Subject: [PATCH] Make a solution of 1.5.5 task more correct Proposed solution is in sync with some previous sort function examples. It also makes sorting stable (does not skip `0` result). --- 1-js/05-data-types/05-array-methods/8-sort-objects/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/05-array-methods/8-sort-objects/solution.md b/1-js/05-data-types/05-array-methods/8-sort-objects/solution.md index 9f1ade70..cfaf9761 100644 --- a/1-js/05-data-types/05-array-methods/8-sort-objects/solution.md +++ b/1-js/05-data-types/05-array-methods/8-sort-objects/solution.md @@ -1,6 +1,6 @@ ```js run no-beautify function sortByAge(arr) { - arr.sort((a, b) => a.age > b.age ? 1 : -1); + arr.sort((a, b) => a.age - b.age); } let john = { name: "John", age: 25 };