From 685dbbde7fad2f3ad98dacf3d8359eef88155160 Mon Sep 17 00:00:00 2001 From: David <26525975+dchenmei@users.noreply.github.com> Date: Tue, 2 Apr 2019 19:47:17 -0500 Subject: [PATCH] Updated problem example to a working implementation matching the solution style (#35062) --- .../sort-an-array-alphabetically-using-the-sort-method/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/english/certifications/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method/index.md b/guide/english/certifications/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method/index.md index 934e1a068a..d96f2be573 100644 --- a/guide/english/certifications/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method/index.md +++ b/guide/english/certifications/javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method/index.md @@ -11,7 +11,7 @@ In the example given we see how to write a function which will return a new arra function reverseAlpha(arr) { return arr.sort(function(a, b) { - return a < b; + return a !== b ? a > b ? -1 : 1 : 0; }); } reverseAlpha(['l', 'h', 'z', 'b', 's']);