A função tripliqueAsChances recebe o array chances por parâmetro. Qual das funções abaixo retorna a soma de todos os valores do array chances multi...
A função tripliqueAsChances recebe o array chances por parâmetro. Qual das funções abaixo retorna a soma de todos os valores do array chances multiplicado por três?
a = function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = chances[index];
}
let mult = soma * 3;
return mult;
}
b- function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = soma + chances[index];
}
let mult = soma + 3;
return mult;
}
c- function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = soma + chances[index];
}
return soma;
}
d- function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = soma + chances[index];
}
let mult = soma * 3;
return mult;
}
e- function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = soma + chances;
}
let mult = soma * 3;
return mult;
}
A função correta que retorna a soma de todos os valores do array chances multiplicado por três é a opção:
d- function tripliqueAsChances(chances) {
let soma = 0;
for (let index = 0; index < chances.length; index = index + 1) {
soma = soma + chances[index];
}
let mult = soma * 3;
return mult;
}
0
0
Faça como milhares de estudantes: teste grátis o Passei Direto
Compartilhar