Javascript Array deviation()

Description

Javascript Array deviation()

Array.prototype.deviation = function () {
    var diff = [],
        mean = this.mean();//from   www.j a v a2 s .  co  m

    for(var i = 0;i<this.length;i++) {
        diff.push(Math.pow(this[i] - mean, 2));
    }

    return Math.sqrt(diff.mean());
};



PreviousNext

Related