Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
clear and verbose solution in Clear category for [old] Median by imtiaz.rahi
function median(d) {
d.sort((a, b) => a-b);
var mid = d.length / 2;
var even = ar => (ar[mid-1] + ar[mid]) / 2;
return d.length % 2 == 0 ? even(d) : d[Math.floor(mid)];
}
Sept. 17, 2019