0
They gave me an exercise but when I send it to see if it’s right they tell me it’s wrong, that it’s not returning the correct value. To be more exact they claim that:
- The function summeDe25(10) must return 2.5
moedas = 0
function somarMoedasDe25 (quantidadeDeMoedas){
for (let i = 0; i < quantidadeDeMoedas; i++){
moedas = moedas + 0.25
}
return moedas
}
But I do tests and when I put 10 as a parameter it returns 2.5
As a beginner, I’m not sure if it’s my code that’s really wrong. Can you help?
They who? With what you posted, you can’t say much. What we know so far is that the function summeDe25(10) returns 2.5, so it is in the post. Missing
;
in your JS, but this should not be a hindrance (the conceptual error is the JS allow, but then runs out of our reach). Another problem is that you initializemoedas
out of function, so if you do the test twice then you will understand the problem.– Bacco