the generic stack object to splice.
the starting index to begin splicing from.
you must provide only positive starting index values.
defaults to 0
.
Optional
deleteCount: numberthe number of elements to remove from the start
index (inclusive).
if it is set to undefined
, then all elements until the end of the generic stack array will be removed.
defaults to undefined
.
insert items at the start
index, so that the first inserted item will occupy the start
index after the splicing.
an array of deleted items in the generic stack will be returned.
a function to splice any stack (see the GenericStack interface).
splicing alone lets you effectively implement all sorts of array mutation methods, such as
push
,pop
,unshift
,shift
,insert
,rotate
, and many more.the
length
property of yourstack
is not mutated/assigned by this function. you will have to do that manually yourself if yourstack
does not modify thelength
property upon thepush
andpop
operations.Example