Sascha Schulz
2023-08-01 c88a9176977fc392c8fddca2e4b68389cb1bef04
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());