This can be done by using splice()
method of an array.
splice()
takes more than 3 arguments. The first is the start index: the place where weโll start making the changes. The second is the delete count parameter. Weโre adding to the array, so the delete count is 0 in all our examples. After this, you can add one or many items an array as you like.
|
|