Created the nthIndexOf method.