Last active
January 21, 2020 09:26
-
-
Save adedayojs/e184fb2b9af927653f141c46738c4ff4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// This function allows you to sum all the numbers in a given array of numbers only | |
function sumNum(array){ | |
// Check if the argument supplied is an array and not an empty array | |
return Array.isArray(array) && array.length > 0 ? array.reduce((a,b)=> (a + b)) : 'Argument supplied is not an array or an empty array' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment