Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Codewars Calculate average

function find_average(array) {
    if (array.length > 0) {
        let average = array.reduce((a, b) => a + b) / array.length
        return average
    } else {
        return 0;
    }
}
 
PREVIOUS NEXT
Tagged: #Codewars #Calculate #average
ADD COMMENT
Topic
Name
7+3 =