Arrays: Left Rotation

  • + 4 comments

    2 lines of JS:

    while(k-- !== 0) a.push(a.shift())
    console.log(a.join(' '));