Skip to content

Commit 9292706

Browse files
committed
challenge4
1 parent 72ac5b6 commit 9292706

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

02-Fundamentals-Part-2/starter/challenge4.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ for (let i = 0; i < contas.length; i++){
88
}
99

1010

11-
1211
let valorTotalDaConta = (contas, gorjeta)=> contas + gorjeta;
1312

1413

@@ -31,5 +30,18 @@ function calcAverage(arr){
3130
}
3231

3332
console.log(`
34-
Média dos numeros contidos no array: ${calcAverage(contas)}
35-
`)
33+
Média dos numeros contidos no array: ${calcAverage(total)}
34+
`)
35+
36+
// O PROFESSOR FEZ ASSIM
37+
38+
let tips = []; // gorjetas
39+
let totals = []; //total da conta
40+
41+
for (let i = 0; i < contas.length; i++){
42+
let tip = totalGorjeta(contas[i]);
43+
tips.push(tip); // totals de gorjetas
44+
totals.push(tip + contas[i]); // total da conta
45+
}
46+
47+
// a função ficou igual a que eu fiz.

0 commit comments

Comments
 (0)