Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Math.avg

Math.avg = (...numbers) => {
    let x = 0
    numbers.forEach(item => {
        x += item
    })
    return x / numbers.length
}

// Usage
console.log(Math.avg(10, 20, 30))
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
9+6 =