From a169885e9c0ef0aa5c429ff2933c888312eeeb4d Mon Sep 17 00:00:00 2001 From: Mayko Costa <111927703+Maykopr@users.noreply.github.com> Date: Sat, 19 Nov 2022 16:00:59 -0300 Subject: [PATCH] conflito nas aspas duplas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fiz alteração por backtick porque a função recursiva não rodava no navegador. --- chapters/03-funcoes.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/chapters/03-funcoes.md b/chapters/03-funcoes.md index 9f13ad15..93b1a9e1 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));