working with javascript array swap it a way to order your array items in the oder that you want your data to be consumed or display .. the snippets bellow may help you archive that.
Now, you may find that using a function to do this a bit weird as well. If you believe that a swap method needs to exist and be available for all arrays in your code, then you can actually extend the Array type with your own swap method
To use this approach, just call the swap method directly from your days array object as shown. The two index positions you pass in will determine which two items will have their contents swapped.