javascript for sample mean