Skip to content

Instantly share code, notes, and snippets.

@neysidev
Created November 28, 2023 07:28
Show Gist options
  • Select an option

  • Save neysidev/f85763b2639c52f72341321b7f9cfb06 to your computer and use it in GitHub Desktop.

Select an option

Save neysidev/f85763b2639c52f72341321b7f9cfb06 to your computer and use it in GitHub Desktop.
function getStd(array) {
const n = array.length;
const mean = array.reduce((a, b) => a + b) / n;
return Math.sqrt(
array.map(x => Math.pow(x - mean, 2)).reduce((a, b) => a + b) / n
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment