unshift
-
Array OperationsDynamicPL/Javascript 2019. 9. 22. 09:05
1. Overview Summarize array operations, such as pop, push, shift, unshift, splice, slice, and split in javascript 2. Description var a = [1, 2, 3]; var b = a.unshift(0); console.log(a); //[0, 1, 2, 3] console.log(b); //4 var a = [1, 2, 3]; var b = a.shift(); console.log(a); //[2, 3] console.log(b); //1 var b = a.shift(2); console.log(a); //[3] console.log(b); //2, only one element is shifted var..