Hi.
Is there an order of operations of sort when de-constructing or constructing arrays?
Example: I have a n array with eight numbers. I want to .shift( ) the the first number in index "0" then .splice( ) the last five numbers.
So, my questions is, does the .shift( ) occur first and then the .splice( ) and should I start the index position after result of the .shift( )? I hope this makes sense. Thank you.
1 const arr = [2, 4, 5, 1, 7, 5, 2, 1];
2 arr.shift(0);
3 arr.splice(3,5);
4 console.log(arr);
0 Answer(s)