implemented indexOf from a given fromIndex