dynamic array 'indexOf' method