v1
- by inphinitphp 11/27/202000
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
var array_soma = [5, 4, 3, 2, 1];

function array_sum_for(arr)
{
    let resultado = 0;

    for (var i = arr.length - 1; i >= 0; i--) resultado += arr[i];

    return resultado;
}

function array_sum_while(arr)
{
    let resultado = 0, i = arr.length;

    while (i--) resultado += arr[i];

    return resultado;
}
delete caserun single casemove downdrag and drop case


ready



var resultado = array_soma.reduce((acumulador, valorAtual) => acumulador + valorAtual, 0);
delete caserun single casemove upmove downdrag and drop case


ready



var resultado = 0;

for (var i = array_soma.length - 1; i >= 0; i--) {
    resultado += array_soma[i];
}
delete caserun single casemove upmove downdrag and drop case


ready



var resultado = array_sum_for(array_soma);
delete caserun single casemove upmove downdrag and drop case


ready



var resultado = 0, i = array_soma.length;
while (i--) resultado += array_soma[i];
delete caserun single casemove updrag and drop case


ready



var resultado = array_sum_while(array_soma);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN