Sascha Schulz
2023-08-15 60c7f2f7d862cb4cf003c3bdf56e11cb18d389d9
1
2
3
4
5
6
7
8
9
10
11
12
13
const a = [1, 2, 4, 8];
 
Array.prototype.sum = function() {
    let sum = 0;
 
    for (let number of this) {
        sum += number;
    }
 
    return sum;
}
 
console.log(a.sum());