Understanding JavaScript Array methods: Unshift and Shift


Shift and Unshift are the counterparts of Push and Pop. This post provides a deep dive into their applications. Unshift Unshift, a unary function, 'shifts' the array to the right and inserts its parameters into the first slots. It then returns the new length of the array. It is the complement of push which appends values … Continue reading Understanding JavaScript Array methods: Unshift and Shift

JavaScript Array Deep Dive: Push and Pop


Push and Pop are two popular methods for handling arrays in JavaScript; this short post explores both array methods. Push Push is used to add elements to the end of an array and returns the array's new length. Pushing a new element into an empty array will return a value of 1 (the new length of the … Continue reading JavaScript Array Deep Dive: Push and Pop