js algorithm to delete the first element in the array

function curtail(arr) {
    
    
var arr1=arr.slice(0);
     arr1.splice(0,1);
    return arr1;
}

Insert picture description here

Idea: First use slice(0) to make a new array.
Then delete an element from the index 0 and output.

Guess you like

Origin blog.csdn.net/qq_37805832/article/details/115189582