The mean()
function returns the mean, or arithmetic average, of its arguments. It accepts numbers, lists of numbers, or a combination of the two.
mean(number, ...)
mean([number, ...])
mean([number], number)
Code language: JavaScript (javascript)
If using dot notation, the numbers must all be part of the same list:
[number, ...].mean()
Code language: JavaScript (javascript)
Example Formulas
mean(15, 35, 70) /* Output: 40 */
[30, 60, 110, 75].mean() /* Output: 68.75 */
mean(2, 5, [4, 30, 13], 9) /* Output: 10.5 */
Code language: JavaScript (javascript)