Skip to content

Instantly share code, notes, and snippets.

@briangonzalez
Created June 20, 2017 20:31
Show Gist options
  • Save briangonzalez/bc5afbb6651d2d55c3352e4900d2cda0 to your computer and use it in GitHub Desktop.
Save briangonzalez/bc5afbb6651d2d55c3352e4900d2cda0 to your computer and use it in GitHub Desktop.
//
// 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