implement indexOf method on array