const arr = [1,2,3,4,5];
const shift = 2;
// rotate left by n < array length:
console.log(`rotated: ${[...arr.slice(shift), ...arr.slice(0,shift)]}`);
// rotated: 3,4,5,1,2
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)