# Complex data strucure: add/remove objects from array

**URL:** <https://forum.kirupa.com/t/complex-data-strucure-add-remove-objects-from-array/313058>\
**Category:** Uncategorized\
**Created:** [August 18, 2010, 9:21pm UTC](https://forum.kirupa.com/t/complex-data-strucure-add-remove-objects-from-array/313058 "2010-08-18T21:21:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phastings](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@phastings](https://forum.kirupa.com/u/phastings)\
**Post date:** [August 18, 2010, 9:21pm UTC](https://forum.kirupa.com/t/complex-data-strucure-add-remove-objects-from-array/313058/1 "2010-08-18T21:21:38Z")

</div>

i haven’t dealt with complex data structures that much and have run across a problem i can’t figure out but that seems should be simple.

i have a loop that populates an array(selectedTeam) with an object(playerInfoHolder)

///this is all in a loop so selectedTeam is an array of playerInfoHolder objects  
playerInfoHolder = new Object();  
playerInfoHolder.name = player.@name;  
playerInfoHolder.number = player.@number;  
playerInfoHolder.position = player.@postion;  
selectedTeam.push(playerInfoHolder);

later i want to be able to remove one of the objects based on the player info(name or number). is there an easy way to do this? is there a way to find the index in the selectedTeam array of a playerInfo object based on it’s data so i can do a split from that index?
