Skip to content

Instantly share code, notes, and snippets.

@MarcelloDiSimone
Created July 13, 2025 12:01
Show Gist options
  • Save MarcelloDiSimone/ee12fb07ac2b9bfa51dc381138bf3fe5 to your computer and use it in GitHub Desktop.
Save MarcelloDiSimone/ee12fb07ac2b9bfa51dc381138bf3fe5 to your computer and use it in GitHub Desktop.
variance
const variance = (n) => (l = n.length, n.reduce((a, b) => a + ((b - (n.reduce((a, b) => a + b, 0) / l)) ** 2), 0) / l);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment