
A Practical Guide to Algorithms with JavaScript Unique Sort Exercise
Transcript from the "Unique Sort Exercise" Lesson
[00:00:00]
>> Bianca: So now it's your turn. Your goal here
>> Bianca: Is to transform this simple sorting algorithm into a uniqSort. So a uniqSort takes an array with duplicates, removes the duplicates, and returns the sorted array.
>> Bianca: And so, the sort is happening for you on line ten. You don't need to worry too much about that.
[00:00:31]
>> Bianca: This method here, or this function here, means that it's gonna be returned in ascending order. If you want it to be in descending order, you just swap these. And the reason we have to do this is because the Java script made of sorts, it's like a string sort.
[00:00:49] So if you have 1, 2, 3, and 12, it'll do 1, 12, 2, 3. And so, that's why we need to pass this callback to tell the sort that we want to actually operate on this kind of comparison, which is a greater than or less than comparison.
>> Bianca: Okay, so you should be able to edit this directly in the slide.
[00:01:15] You can also open it in Repl.it. And then, you can fork it. And then, you can save them if you want. And you can have a copy of all the exercises that you've worked on and your solutions in your own Repl.it. You will have to make a Repl.it account though.