Skip to content

Commit

Permalink
refactoring task 5
Browse files Browse the repository at this point in the history
  • Loading branch information
iAlgebra committed Nov 19, 2019
1 parent afa778b commit fb8dde0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tareas/clase-4/algoritmo-5.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Desafío de programación #5: Calcula el resultado de la suma de los numeros del
1 + 2 + 3 + ... + 10 = ? //hacerlo con un array y un bucle
*/

function addArray(arr) {
function addArrayFromOneToTen() {
let result = 0;
for (let i = 0; i < arr.length; i++) {
result += arr[i];
for (let i = 1; i <= 10; i++) {
result += i;
}
console.log(result);
}

addArray([1,2,3,4,5,6,7,8,9,10]);
addArrayFromOneToTen();

0 comments on commit fb8dde0

Please sign in to comment.