# Is there a reason I can't use a variable as the array name using shift and push?

**URL:** <https://forum.kirupa.com/t/is-there-a-reason-i-cant-use-a-variable-as-the-array-name-using-shift-and-push/168748>\
**Category:** Uncategorized\
**Created:** [November 9, 2005, 6:24pm UTC](https://forum.kirupa.com/t/is-there-a-reason-i-cant-use-a-variable-as-the-array-name-using-shift-and-push/168748 "2005-11-09T18:24:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benswift](https://avatars.discourse-cdn.com/v4/letter/b/b4bc9f/32.png) [@benswift](https://forum.kirupa.com/u/benswift)\
**Post date:** [November 9, 2005, 6:24pm UTC](https://forum.kirupa.com/t/is-there-a-reason-i-cant-use-a-variable-as-the-array-name-using-shift-and-push/168748/1 "2005-11-09T18:24:04Z")

</div>

I’ve looked in the documentation and found nothing. I’m in MX 2004 pro.

here’s my code:

```auto

var arrayName = "name";
trace(arrayName);

var numberofPics = arrayName.length;
trace("array length = " + numberofPics);
shifted = arrayName.shift();
trace("shifted = " + shifted);
arrayName.push(shifted);
trace("ordered pic is " + shifted);

```

RESULTS:  
the ‘trace(arrayName)’ comes back correctly.  
the ‘trace("array length = " + numberofPics)’ comes back correctly- which means that ‘var numberofPics = arrayName.length’ works correctly.  
when it gets to the ‘trace("shifted = " + shifted)’ it comes back as "shifted = "  
when it gets to the ‘trace("ordered pic is " + shifted)’ it comes back as "ordered pic is "  
so is it just that a variable can’t be used as the name of an array when using shift and push?
