Skip to content

Instantly share code, notes, and snippets.

@wesdeveloper
Created February 25, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wesdeveloper/b5c1ce5a505025ed1e021da534b318b2 to your computer and use it in GitHub Desktop.
Save wesdeveloper/b5c1ce5a505025ed1e021da534b318b2 to your computer and use it in GitHub Desktop.
Function calcula média
function media(...arguments) {
total = arguments.reduce((a,b) => a+b);
return total/arguments.length;
}
console.log(media(12,6,6,3));
@wesdeveloper
Copy link
Author

wesdeveloper commented Mar 15, 2017

const media = (...arguments) => arguments.reduce((a,b) => a+b) / arguments.length;

console.log(media(12,6,6,3));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment