feat: Resolve o exercício 06-sum

This commit is contained in:
SamuelCondack 2022-10-27 17:29:05 -03:00
parent 0771958d28
commit c29171035f
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,8 @@
export function sum(values) { export function sum(values) {
// implementar logica aqui // implementar logica aqui
let add = 0
for (let p = 0; p < values.length; p++) {
add += values[p]
}
return add
} }

View File

@ -44,6 +44,6 @@ describe("sum", () => {
}); });
it("Dever retornar -40 quando passamos o array [-2, -7, -31]", () => { it("Dever retornar -40 quando passamos o array [-2, -7, -31]", () => {
expect(sum([-2, -7, -31])).toBe(-51); expect(sum([-2, -7, -31])).toBe(-40);
}) })
}); });