0
Hello,
I am in the following statement trying to complete:
"Oh, but it doesn’t end here" - said Ana "I want to know how many months there was profit, IE, the balance was greater than zero" . Complete the quantityDeMesesComucro function. Example: Function quantityDeMesesComputer(a Precedent) { Let quantity= ??? ; for (Let mes=0; mes< umPeriodo.length; mes+) { ?? } quantity Return; }
And I made the following code:
function quantidadeDeMesesComLucro(umPeriodo){
let quantidade = 0;
for(let mes = 0; mes < umPeriodo.length; mes++){
if(umPeriodo[mes] < 0)
quantidade += 1;
}
return quantidade;
}
And the following errors appear stating that the solution has not completely passed:
x quantityDeMesesComucro([1]) is 1
0 deepEqual 1
x quantityDeMesesComucro([2, 20, 20]) is 3
0 deepEqual 3
x quantityDeMesesComucro([10, -10, 2, 100]) is 3
0 deepEqual 3
Can someone help me? Thank you!
Shouldn’t be
umPeriodo[mes] > 0
instead ofumPeriodo[mes] < 0
?– Andre
The error remains in both ways.
– Jeh