add index of and last index of for array.