I have an array with 5 values. I want to cycle through the array so that the values index all increase by one and the item in the final position moves to the front of the array. So for example:
[1,2,3,4,5]
Would become:
[5,1,2,3,4]
In python it is as simple as this:
lst = [1, 2, 3, 4, 5]
lst = lst[-1] + lst[:-1]
However I am not able to figure out how to do this in javascript
What is the correct syntax for performing this in javascript?