• + 2 comments

    :( I'm also stuck at test case 8. The message throws "Run time error" Don't know if there's any alternatives rather the traditional for / pop push method ? My current code (Pass all test cases except test case 8)

    function rotLeft(a, d) {
        let newArray = [...a];
        let iterationCount = 0;
        while(iterationCount < d){
            let valueToPop = newArray[0];
            newArray.shift();
            newArray.push(valueToPop);
            iterationCount++;
         }
        return newArray;
    }