Wie man zu kleinen Zahlen summiert
function sumTwoSmallestNumbers(numbers) {
var min = Number.MAX_SAFE_INTEGER;
var secondMin = Number.MAX_SAFE_INTEGER;
var n;
for (i = 0; i < numbers.length; i++) {
n = numbers[i];
if(n < min) {
secondMin = min;
min = n;
} else if( n < secondMin ) {
secondMin = n;
}
}
return min + secondMin;
}
Green Team