# How to identify objects of a class

**URL:** <https://forum.kirupa.com/t/how-to-identify-objects-of-a-class/219548>\
**Category:** Uncategorized\
**Created:** [March 17, 2007, 8:03pm UTC](https://forum.kirupa.com/t/how-to-identify-objects-of-a-class/219548 "2007-03-17T20:03:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerryjones](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jerryjones](https://forum.kirupa.com/u/jerryjones)\
**Post date:** [March 17, 2007, 8:03pm UTC](https://forum.kirupa.com/t/how-to-identify-objects-of-a-class/219548/1 "2007-03-17T20:03:46Z")

</div>

say i have a class…we’ll call it “song” for the sake of example…song has the attributes artist, title, album. upon makign all the objects, i put them in an array…

```auto
songArray:Array = new Array();
songArray.push(new song("billy joel","row row row your boat","dont rock the boat"));
songArray.push(new song("slayer","happy birthday","i hope your cake explodes"));
//etc.etc. etc.

```

later, maybe i want to figure out which element of songArray contains the object whose title is “london bridge”. is there a better way to do this than checking every single element in songArray?..like below

```auto

for (a = 0; a < songArray.length; a++){
    if (songArray[a].title == "london bridge")
        trace("this is it");
}

```

whether i want to find one object that has a unique attribute (like “london bridge”, maybe) or multiple objects that might have the same attribute (like an artist or album), is there a more efficient way?
