Function to find mean of grouped data .
function mean ( mid , freq , n ) { let sum = 0 , freqSum = 0 ; for ( let i = 0 ; i < n ; i ++ ) { sum = sum + mid [ i ] * freq [ i ] ; freqSum = freqSum + freq [ i ] ; } return sum / freqSum ; }