JSFiddle - React, Tailwind, and code Playground

by Slico

JavaScript

let theArr = [1, 2, 3, 4, 5]

const rotLeft = function(a, d) {

  console.log(...a.slice(d), ...a.slice(0, d))

}


console.log(rotLeft(theArr, 4))