You wouldn't need to splice out this temp array if you expanded the array and moved the items to the end before assigning the new items.  Also, the code to insert new items can be the same in either case.