Created
June 20, 2017 20:31
-
-
Save briangonzalez/bc5afbb6651d2d55c3352e4900d2cda0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// A user has purchased products from Dollar Shave Club, | |
// noted below in the `purchased` array. When these products | |
// came out of our database, they were unsorted. | |
// | |
// Write the method below, `sortProducts`, to obtain a sorted | |
// array of the items purchased. | |
// | |
const sortedReference = [ | |
'ITEM-1', | |
'ITEM-2', | |
'ITEM-3', | |
'ITEM-4', | |
'ITEM-5', | |
'ITEM-6', | |
'ITEM-7', | |
'ITEM-8', | |
'ITEM-9', | |
'ITEM-10', | |
]; | |
const purchased = [ | |
'ITEM-3', | |
'ITEM-1', | |
'ITEM-5', | |
'ITEM-10', | |
'ITEM-8', | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment