Which function can combine the functionalities of push, pop, unshift and shift?

Which function can combine the functionalities of push, pop, unshift and shift? Correct Answer splice

The splice function can perform all the four functions performed by these functions. It uses upto four arguments to add or remove elements at any location of the array. The second argument is the offset from where we’ve to perform insertion or deletion, the third argument represents the number of elements to be removed. If it is 0, elements are to be added. The fourth argument specifies the new replaced list. For example, @list= (1,2,3,4,5,9) ; splice(@list, 5, 0, 6. . 8); //adds at 6th location -1,2,3,4,5,6,7,8,9

Related Questions