# Moving array items - Best practice?

**URL:** <https://forum.kirupa.com/t/moving-array-items-best-practice/311245>\
**Category:** flash\
**Created:** [July 1, 2010, 2:31am UTC](https://forum.kirupa.com/t/moving-array-items-best-practice/311245 "2010-07-01T02:31:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theSchtickler](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theSchtickler](https://forum.kirupa.com/u/theSchtickler)\
**Post date:** [July 1, 2010, 2:31am UTC](https://forum.kirupa.com/t/moving-array-items-best-practice/311245/1 "2010-07-01T02:31:19Z")

</div>

Hi there,

This has been on my mind for a while, that I’m doing this wrong, so I thought I’d ask for some advice…

Lets say I have an array full of items, there are nested arrays within each item. What is the best way to move array\_item[5] to array\_item[3].

The way I do it at the moment, is  
• create a temp\_array\_item  
• loop thru array\_item[5] to get everything out and transfer it to temp\_array\_item  
• delete array\_item[5]  
• then splice an empty item into postion 3  
• loop thru the temp\_array\_item and put it all back

This seems terribly inefficient to me, can someone please help?

Thanks!
