diff --git a/chapters/03-funcoes.md b/chapters/03-funcoes.md index 9f13ad1..93b1a9e 100644 --- a/chapters/03-funcoes.md +++ b/chapters/03-funcoes.md @@ -346,16 +346,17 @@ Aqui está uma solução recursiva: ```js function findSolution(target) { - function find(start, history) { - if (start == target) + function find(current, history) { + if (current == target) { return history; - else if (start > target) + } else if (current > target) { return null; - else - return find(start + 5, “(“ + history + “ + 5)”) || - find(start * 3, “(“ + history + “ * 3)”); + } else { + return find(current + 5, `(${history} + 5)`) || + find(current * 3, `(${history} * 3)`); + } } - return find(1, “1”); + return find(1, "1"); } console.log(findSolution(24));