diff --git a/Sorts/CocktailShakerSort.js b/Sorts/CocktailShakerSort.js index f32a1f2ad..a6e13548f 100644 --- a/Sorts/CocktailShakerSort.js +++ b/Sorts/CocktailShakerSort.js @@ -8,6 +8,18 @@ * Wikipedia (Bubble Sort): https://en.wikipedia.org/wiki/Bubble_sort * */ + + /** + * Doctests + * + * > cocktailShakerSort([5, 4, 1, 2, 3]) + * [1, 2, 3, 4, 5] + * > cocktailShakerSort([]) + * [] + * > cocktailShakerSort([1, 2, 3]) + * [1, 2, 3] + */ + function cocktailShakerSort (items) { for (let i = items.length - 1; i > 0; i--) { let j