remove first element from array and return the array minus the first element

后端 未结 5 1390
温柔的废话
温柔的废话 2021-01-31 01:09



        
5条回答
  •  梦谈多话
    2021-01-31 01:26

    Try this

        var myarray = ["item 1", "item 2", "item 3", "item 4"];
    
        //removes the first element of the array, and returns that element apart from item 1.
        myarray.shift(); 
        console.log(myarray); 
    

提交回复
热议问题