Created
February 25, 2017 04:27
-
-
Save wesdeveloper/b5c1ce5a505025ed1e021da534b318b2 to your computer and use it in GitHub Desktop.
Function calcula média
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function media(...arguments) { | |
total = arguments.reduce((a,b) => a+b); | |
return total/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
const media = (...arguments) => arguments.reduce((a,b) => a+b) / arguments.length;
console.log(media(12,6,6,3));