Moving the first JavaScript array item to the end

As an example for the use case, have you every ran into API’s which proudly feed you with week day based data, but ordered not in a way you expected, typically starting the week with Sunday, not Monday, or the other way around?

  const data = [`Sunday`, `Monday`, ..., `Saturday`]

Well, there’s a single line cure for this:



  console.log(data) // -> [`Monday`, ..., `Saturday`, `Sunday`]

Keep in mind you don’t need to reassign this to the variable as the modifications are performed directly on the array.