Skip to content

Instantly share code, notes, and snippets.

@sayyedhammadali
Last active October 5, 2021 09:53
Show Gist options
  • Save sayyedhammadali/e11c1199d95f88b3093aa743ee87260f to your computer and use it in GitHub Desktop.
Save sayyedhammadali/e11c1199d95f88b3093aa743ee87260f to your computer and use it in GitHub Desktop.
Get the Average of an Array of Number
const average = arr => arr.reduce((a, b) => a + b) / arr.length;
average([21, 56, 23, 122, 67])
//57.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment