functionshiftArray(arr){// Get the last element in the arrayconstlastElement=arr[arr.length-1];// Prepend the `lastElement` to the start of the arrayarr.unshift(lastElement);// Remove the duplicate element at the end of the arrayarr.pop();// Hooray! We party! 🎉returnarr;}// Plop in `theList`shiftArray(theList);
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think this will do just fine.