# How to detect multiple same items in an array

**URL:** <https://forum.kirupa.com/t/how-to-detect-multiple-same-items-in-an-array/182444>\
**Category:** Uncategorized\
**Created:** [March 18, 2006, 7:59am UTC](https://forum.kirupa.com/t/how-to-detect-multiple-same-items-in-an-array/182444 "2006-03-18T07:59:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![witxhhaven](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@witxhhaven](https://forum.kirupa.com/u/witxhhaven)\
**Post date:** [March 18, 2006, 7:59am UTC](https://forum.kirupa.com/t/how-to-detect-multiple-same-items-in-an-array/182444/1 "2006-03-18T07:59:16Z")

</div>

hello, first time here… want to ask a question which i have been thinking for quite sometime …

say i have an array be it of any length …

[COLOR=Sienna]var Myarray= new array(“apple”, “pear”, “apple”,“orange”, “apple”,“pear” )

[COLOR=Black]how shld i write a function that will detect and group similar items into each individual unqiue counter,

item “apple” :3  
item “pear” : 2  
item “orange”:1

also does anyone here have resources(books or website) for problem solving for actionscript… problems like the one on top… ? I really need to learn to improve in different approaches in solving a scripting problem.  
[/COLOR][/COLOR]

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [March 20, 2006, 11:47am UTC](https://forum.kirupa.com/t/how-to-detect-multiple-same-items-in-an-array/182444/2 "2006-03-20T11:47:09Z")

</div>

> [@witxhhaven](#):
>
> thanks alot :trout:

welcome
