challenge-algorithms-v2.0-M.../06-sum/index.js

22 lines
462 B
JavaScript

export function sum(values) {
// implementar logica aqui
var array = [1];
var array = [1, 2];
var array = [1, 2, 3];
var array = [1, 2, 3, 4];
var array = [4, 6, 12, 5];
var array = [9, 234, 312, 999, 21, 2311];
var array = [533, 234, 23423, 32, 48876];
var array = [-1, 5, -10, -45];
var array = [-2, -7, -31];
var sum = 0;
}
for (var i = 0; i < array.length; i++) {
if (array[i] >= 2) {
total += array[i];
}
}
console.log(sum);