# indexOf question

**URL:** <https://forum.kirupa.com/t/indexof-question/247524>\
**Category:** Uncategorized\
**Created:** [December 25, 2007, 11:56am UTC](https://forum.kirupa.com/t/indexof-question/247524 "2007-12-25T11:56:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kakepi](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@kakepi](https://forum.kirupa.com/u/kakepi)\
**Post date:** [December 25, 2007, 11:56am UTC](https://forum.kirupa.com/t/indexof-question/247524/1 "2007-12-25T11:56:30Z")

</div>

hi,

indexOf() is useful for finding the index number of an element in an array, but what should be the method when the element occurs more than once and we want to get all the index numbers?

I thought such an approach would work, doesn’t seem to:

var index:int = array.indexOf(“word”);  
trace(index);  
var index2:int = array.indexOf(“word”, index);  
trace(index2)

thanks.
