# Work around for filter creating new array?

**URL:** <https://forum.kirupa.com/t/work-around-for-filter-creating-new-array/304979>\
**Category:** Uncategorized\
**Created:** [February 17, 2010, 2:51pm UTC](https://forum.kirupa.com/t/work-around-for-filter-creating-new-array/304979 "2010-02-17T14:51:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)\
**Post date:** [February 17, 2010, 2:51pm UTC](https://forum.kirupa.com/t/work-around-for-filter-creating-new-array/304979/1 "2010-02-17T14:51:52Z")

</div>

Hi

if I have

```auto
var myArray: Array = new Array(1,2,3);

```

and I then use this as an argument in the constructor of some object eg

```auto
var someObject:SomeClass = new SomeClass(myArray);

```

but then I do this

```auto
myArray=myArray.filter(someFilteringFunction);

```

the ‘myArray’ passed to ‘someObject’ is no longer linked to/the same array as the ‘myArray’ that has been filtered.

I do want to filter the first array but I also want them to stay the same. How do I do that ?

I have tried and intermediary array with no success.

After days of trying the work out what was going on in my code I am totally open to any suggestions (and some more sleep!!)

Thank you for your consideration,

S.
