Updated problem example to a working implementation matching the solution style (#35062)
This commit is contained in:
@ -11,7 +11,7 @@ In the example given we see how to write a function which will return a new arra
|
|||||||
|
|
||||||
function reverseAlpha(arr) {
|
function reverseAlpha(arr) {
|
||||||
return arr.sort(function(a, b) {
|
return arr.sort(function(a, b) {
|
||||||
return a < b;
|
return a !== b ? a > b ? -1 : 1 : 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
reverseAlpha(['l', 'h', 'z', 'b', 's']);
|
reverseAlpha(['l', 'h', 'z', 'b', 's']);
|
||||||
|
Reference in New Issue
Block a user