node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

median

Median

A small module for node and browser to calculate median.

Install

NPM

$ npm install median

or you can download the repo and use median.js

Usage

Node.js

var median = require('median')
var arr = [1, 15, 200, 30]
var value = median(arr)
 
console.log("median value is " + value)

Browser

var arr = [1, 15, 200, 30]
var value = window.median(arr)
 
console.log("median value is " + value)