average()

Computes the average of a sequence.

Syntax

Return Value

Type: number
The average of the sequence of values.

Examples

var grades = [ 78, 92, 100, 37, 81 ];

var average = $from(grades).average();

document.writeln("The average grade is " + average);

// This code produces the following output:
//
// The average grade is 77.6. 

Last edited May 16, 2012 at 2:22 AM by suckgamoni, version 1

Comments

No comments yet.