In statistics, Mode is the most common number in a data set.
// not the actual way to do it, just pointing out the idea
const mode = (arr) => arr.reduce((acc, el) => {
acc.counters[el] = acc.counters[el] ? acc.counters[el] + 1 : 1
if(acc.max) {
acc.max = acc.max < acc.counters[el] ? el : acc.max
} else {
acc.max = el
}
}, {counters: {}, max: undefined}).max
const x = [1,1,2,3,4,5]
mode(x) // 1
Also see MedianMedian
In statistics, Median is the number sitting in the middle of a sorted set of numbers.
// not the actual way to do it, just pointing out the idea
const median = (sortedArray) => sortedArray[arr... and MeanMean
In Statistics, Mean is the thing you normally know as "average". It's calculated by summing all numbers and then dividing the sum by the number of numbers.
// not the actual way to do it, just po....
Status: #🌲