I suggest to also have a function d3.medianIndex(). E.g. it could return an array - with one element: the index of the corresponding element - in case the array.length is uneven - with two elements: the indices of the elements from which the mean was taken - in case the array.length is even