diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..f2ec99f 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,7 @@ export function fibonacci(value) { // implementar logica aqui - -} \ No newline at end of file + if (value <= `${1}`) { + return value; + } + return fibonacci(value - 1) + fibonacci(value - 2); +} diff --git a/06-sum/index.js b/06-sum/index.js index ebc2ee1..d071540 100644 --- a/06-sum/index.js +++ b/06-sum/index.js @@ -1,4 +1,8 @@ export function sum(values) { // implementar logica aqui - -} \ No newline at end of file + function add(a, b) { + return a + b; + } + var soma = values.reduce(add, 0); + return soma; +}