Arrays: Left Rotation

  • + 0 comments

    what went wrong with this code? function rotLeft(a, d) { // Write your code here

    let sArr = a.slice(0,d);
    let rArr = a.slice(d)
    let rotArr =rArr.concat(sArr)
    
    let str = "";
    rotArr.forEach(function(element){
        str += element + " ";
    })
        console.log(str)
    

    }