From 4608280a0672145940282b680faeff4393b6aeb1 Mon Sep 17 00:00:00 2001 From: Carol Silva Date: Fri, 28 Oct 2022 17:15:09 -0300 Subject: [PATCH 01/34] adiciona exercioc 2 --- Desafios/Arrays/desafio-arrays-01.js | 13 +++++++++++-- Desafios/Arrays/desafio-arrays-02.js | 10 +++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Desafios/Arrays/desafio-arrays-01.js b/Desafios/Arrays/desafio-arrays-01.js index 5bbe691..530f150 100644 --- a/Desafios/Arrays/desafio-arrays-01.js +++ b/Desafios/Arrays/desafio-arrays-01.js @@ -7,8 +7,17 @@ Escreva um algoritmo que recebe um array de números inteiros, procure o maior v */ function getMaxNumber(numbers) { - // Desenvolva seu código nessa função - return // Retorne o resultado aqui + let number = numbers[0]; + let maiorNumero; + for (let index = 0; index < numbers.length; index++) { + const element = numbers[index]; + if(numbers[index] > number){ + number = numbers[index] + } + } + return number; } +console.log(getMaxNumber([ 2,34,5,1,2])); + module.exports = getMaxNumber; diff --git a/Desafios/Arrays/desafio-arrays-02.js b/Desafios/Arrays/desafio-arrays-02.js index 9f275f7..c4bd0c4 100644 --- a/Desafios/Arrays/desafio-arrays-02.js +++ b/Desafios/Arrays/desafio-arrays-02.js @@ -7,8 +7,16 @@ Escreva um algoritmo que recebe um array de números inteiros, procure o menor v */ function getMinNumber(numbers) { + let teste; + let n = numbers[0]; + for (const number of numbers) { + if(numbers[number] < n){ + n = numbers[number] + } + } // Desenvolva seu código nessa função - return // Retorne o resultado aqui + return n; } +console.log(getMinNumber([24,15,14,13,44,1,44,55])) module.exports = getMinNumber; From 5e145b5bb501e905978a195099ef1ff60e758421 Mon Sep 17 00:00:00 2001 From: Carol Silva Date: Fri, 22 Apr 2022 17:06:53 -0300 Subject: [PATCH 02/34] Criado index para pasta --- Desafios/Destructuring e HOFs/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Desafios/Destructuring e HOFs/index.js diff --git a/Desafios/Destructuring e HOFs/index.js b/Desafios/Destructuring e HOFs/index.js new file mode 100644 index 0000000..2e39fdb --- /dev/null +++ b/Desafios/Destructuring e HOFs/index.js @@ -0,0 +1,15 @@ +const getBandsInformation = require('./desafio-hofs-01.js'); +const getBestAlbuns = require('./desafio-hofs-02.js'); +const getBandsName = require('./desafio-hofs-03.js'); +const usaFilter = require('./desafio-hofs-04.js'); +const rockFilter = require('./desafio-hofs-05.js'); +const highestRatingFilter = require('./desafio-hofs-06.js'); + +module.exports = { + getBandsInformation, + getBestAlbuns, + getBandsName, + usaFilter, + rockFilter, + highestRatingFilter +}; From f0e398f79d001f362b2acd09c44d3a45b33b594c Mon Sep 17 00:00:00 2001 From: Carol Silva Date: Fri, 22 Apr 2022 17:07:27 -0300 Subject: [PATCH 03/34] Ajuste de only para describe --- test/strings.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/strings.test.js b/test/strings.test.js index b618d09..4c8df79 100644 --- a/test/strings.test.js +++ b/test/strings.test.js @@ -75,7 +75,7 @@ describe("Desafios de Strings.", () => { }); }); - only("07 - Testando a Função includeA.", () => { + describe("07 - Testando a Função includeA.", () => { it(`Ao passar o argumento 'Coragem', deve retornar: 'A palavra Coragem possui a letra 'a', porém não é a primeira nem a última letra.'`, () => { expect(includeA("Coragem")).toBe( From 3713b98352ce4fc2650de7d41e1f10fa10bb070a Mon Sep 17 00:00:00 2001 From: Carol Silva Date: Fri, 22 Apr 2022 17:07:42 -0300 Subject: [PATCH 04/34] Ajuste de nome --- test/destructuringEHofs.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 4389418..35fa836 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -5,7 +5,7 @@ const { usaFilter, rockFilter, highestRatingFilter, -} = require('../Desafios/Destructuring e HOFs'); +} = require("../Desafios/Destructuring e Hofs/"); describe("Desafios de Destructuring e HOFs.", () => { describe("01 - Testando a Função getBandsInformation.", () => { From 9a36cf4e63d6ec99906c1cf5cf267f191af02c16 Mon Sep 17 00:00:00 2001 From: Carol Silva Date: Fri, 22 Apr 2022 17:10:36 -0300 Subject: [PATCH 05/34] Ajuste de texto --- test/estruturasCondicionais.test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/estruturasCondicionais.test.js b/test/estruturasCondicionais.test.js index 6a4f47c..a0960df 100644 --- a/test/estruturasCondicionais.test.js +++ b/test/estruturasCondicionais.test.js @@ -411,19 +411,19 @@ describe("Desafios de Estruturas Condicionais.", () => { it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'Mara venceu com 40 pontos'", () => { expect(cardsGame(10, 10, 5, 5)).toBe("Mara venceu com 40 pontos"); }); - it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'Mara venceu com 63 pontos'", () => { + it("Ao passar os argumentos 10, 11, 11, 115, deve retornar: 'Mara venceu com 63 pontos'", () => { expect(cardsGame(10, 11, 11, 11)).toBe("Mara venceu com 63 pontos"); }); - it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'Sara venceu com 40 pontos'", () => { + it("Ao passar os argumentos 5, 5, 10, 10, deve retornar: 'Sara venceu com 40 pontos'", () => { expect(cardsGame(5, 5, 10, 10)).toBe("Sara venceu com 40 pontos"); }); - it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'Sara venceu com 69 pontos'", () => { + it("Ao passar os argumentos 2, 12, 11, 12, deve retornar: 'Sara venceu com 69 pontos'", () => { expect(cardsGame(12, 12, 11, 12)).toBe("Sara venceu com 69 pontos"); }); - it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'O jogo empatou'", () => { + it("Ao passar os argumentos 12, 12, 12, 12, deve retornar: 'O jogo empatou'", () => { expect(cardsGame(12, 12, 12, 12)).toBe("O jogo empatou"); }); - it("Ao passar os argumentos 10, 10, 5, 5, deve retornar: 'O jogo empatou'", () => { + it("Ao passar os argumentos 11, 12, 11, 12, deve retornar: 'O jogo empatou'", () => { expect(cardsGame(11, 12, 11, 12)).toBe("O jogo empatou"); }); }); From ce0ab6dd9e88db6e9aca36991b72c6b38572e8a5 Mon Sep 17 00:00:00 2001 From: Lucas Leal Date: Mon, 16 May 2022 17:13:01 -0300 Subject: [PATCH 06/34] =?UTF-8?q?Adiciona=20teste=20de=20formata=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20telefone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Desafios/Strings/Gabaritos/10.js | 19 +++++++++++++++++++ Desafios/Strings/desafio-strings-10.js | 26 ++++++++++++++++++++++++++ Desafios/Strings/index.js | 2 ++ test/strings.test.js | 22 ++++++++++++++++++++-- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 Desafios/Strings/Gabaritos/10.js create mode 100644 Desafios/Strings/desafio-strings-10.js diff --git a/Desafios/Strings/Gabaritos/10.js b/Desafios/Strings/Gabaritos/10.js new file mode 100644 index 0000000..7d60b0d --- /dev/null +++ b/Desafios/Strings/Gabaritos/10.js @@ -0,0 +1,19 @@ +function telephoneFormat(string) { + //se não for válido retorna a própria variável + if (!string) return string; + //converte para string + if (typeof string === "number") string = string.toString(); + //remove tudo que não for número + string = string.replace(/[^0-9]/g, ""); + if (string.length < 10 || string.length > 11){ + //se tiver menos largura que 10 ou mais de 11, é inválido + return string; + } + const regex = /^([0-9]{2})([0-9]?)([0-9]{4})([0-9]{4})$/gm; + const subst = `($1) $2 $3-$4`; + //aplica o regex de formatação e remove espaços duplicados causados + //pela possível ausência do dígito 9 antes do número + return string.replace(regex, subst).replace(' ',' '); +} + +module.exports = telephoneFormat; diff --git a/Desafios/Strings/desafio-strings-10.js b/Desafios/Strings/desafio-strings-10.js new file mode 100644 index 0000000..304b58d --- /dev/null +++ b/Desafios/Strings/desafio-strings-10.js @@ -0,0 +1,26 @@ +/* + +10 - Telefone desconfigurado + +Um banco de dados possui uma série de números de telefone, mas cada um com um padrão diferente. +Alguns têm espaço, outros não, alguns sem traço, outros não, alguns com parênteses, outros não, +e toda sorte de combinações possíveis e imagináveis. + +Crie uma função que receba um número de telefone desconfigurado +e retorne o número de telefone formatado, com suporte ao dígito 9 +de prefixo nos celulares, mas funcionando normalmente sem esse prefixo. + +O que será avaliado? +- Ao enviar como parâmetro 11 97878-7878 a função deve retornar (11) 9 7878-7878; +- Se o parâmetro for (11)78787878 a função deve retornar (11) 7878-7878; +- Se o parâmetro for 1178787878 a função deve retornar (11) 7878-7878; +- E se não for um número de telefone válido a função deve retornar o parâmetro; logo: +- Se o parâmetro for 234 a função deve retornar 237; + +*/ + +function telephoneFormat(string) { + // Desenvolva seu código nessa função +} + +module.exports = telephoneFormat; diff --git a/Desafios/Strings/index.js b/Desafios/Strings/index.js index 7802063..747ee96 100644 --- a/Desafios/Strings/index.js +++ b/Desafios/Strings/index.js @@ -7,6 +7,7 @@ const dogName = require("./desafio-strings-06") const includeA = require("./desafio-strings-07") const countLetters = require("./desafio-strings-08") const encodeMessage = require("./desafio-strings-09") +const telephoneFormat = require("./desafio-strings-10") module.exports = { reverseNames, @@ -18,4 +19,5 @@ module.exports = { includeA, countLetters, encodeMessage, + telephoneFormat, } diff --git a/test/strings.test.js b/test/strings.test.js index 4c8df79..f16e59e 100644 --- a/test/strings.test.js +++ b/test/strings.test.js @@ -12,7 +12,9 @@ const { includeA, countLetters, encodeMessage, -} = require("../Desafios/Strings/Gabaritos/1-9"); */ +} = require("../Desafios/Strings/Gabaritos/1-9"); +telephoneFormat = require("../Desafios/Strings/Gabaritos/10"); +*/ const { reverseNames, @@ -24,6 +26,7 @@ const { includeA, countLetters, encodeMessage, + telephoneFormat, } = require("../Desafios/Strings"); describe("Desafios de Strings.", () => { @@ -132,7 +135,7 @@ describe("Desafios de Strings.", () => { }); }); - describe("09- Testando a Função encodeMessage.", () => { + describe("09 - Testando a Função encodeMessage.", () => { it("Ao passar o argumento 'aeiou', deve retornar: '5b9p1'", () => { expect(encodeMessage("aeiou")).toBe("5b9p1"); }); @@ -140,4 +143,19 @@ describe("Desafios de Strings.", () => { expect(encodeMessage(test9)).toBe(resp9); }); }); + + describe("10 - Testando a Função telephoneFormat.", () => { + it("Ao passar o argumento '11 97878-7878', deve retornar: '(11) 9 7878-7878'", () => { + expect(telephoneFormat("11 97878-7878")).toBe("(11) 9 7878-7878"); + }); + it("Ao passar o argumento '(11)78787878', deve retornar: '(11) 7878-7878'", () => { + expect(telephoneFormat("(11)7878-7878")).toBe("(11) 7878-7878"); + }); + it("Ao passar o argumento 1178787878, deve retornar: '(11) 7878-7878'", () => { + expect(telephoneFormat(1178787878)).toBe("(11) 7878-7878"); + }); + it("Ao passar um argumento inválido o mesmo deve ser retornado", () => { + expect(telephoneFormat("234")).toBe("234"); + }); + }); }); From 0162a214384827314b1d7a406b4f593d9c12ba65 Mon Sep 17 00:00:00 2001 From: Kissyla <67333783+mottak@users.noreply.github.com> Date: Mon, 30 May 2022 15:18:03 -0300 Subject: [PATCH 07/34] corrige-operadores-aritmeticos corrige formula IMC exercicio 6 operadores aritmeticos --- test/operadoresAritmeticos.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/operadoresAritmeticos.test.js b/test/operadoresAritmeticos.test.js index 6adbc36..4f4a6a8 100644 --- a/test/operadoresAritmeticos.test.js +++ b/test/operadoresAritmeticos.test.js @@ -116,7 +116,7 @@ describe("Desafios de Operadores Aritméticos.", () => { describe(" 06 - Testando a Função IMC.", () => { const height = +`1.${getRandomInt(40, 99)}` const weight = getRandomInt(40, 120); - const imc = (height * height) / weight; + const imc = weight / (height * height); it("Ao passar os argumentos 70 e 1.8 , deve retornar: 0.04628571428571429", () => { expect(IMC(70, 1.8)).toBe(0.04628571428571429); }); From 8f9972d28f4d85fc2938470eb4433e74b4dc4cb3 Mon Sep 17 00:00:00 2001 From: Kissyla <67333783+mottak@users.noreply.github.com> Date: Mon, 30 May 2022 15:54:41 -0300 Subject: [PATCH 08/34] Update desafio-operadores-aritmeticos-08.js modificacao enunciado exercicio 8 Operadores Aritmeticos --- .../desafio-operadores-aritmeticos-08.js" | 1 + 1 file changed, 1 insertion(+) diff --git "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" index 4ab6216..996d9b1 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" @@ -5,6 +5,7 @@ Escreva um algoritmo que recebe o valor de um prato, calcule e retorne o valor final dele acrescendo 10% de taxa por ser uma área turística e mais 5% de gorjeta para o garçon. Obs: Retornar um valor do tipo number com duas casa decimais. +Obs2: Dependendo do método usado para arredondar o tipo da sua variavél pode mudar, e aqui o retorno DEVE ser do tipo NUMBER. Talvez seja preciso converter para number ao final. */ From 58a2deed92c0287e9c3dbb901e6e36a2942cb060 Mon Sep 17 00:00:00 2001 From: Kissyla <67333783+mottak@users.noreply.github.com> Date: Mon, 30 May 2022 16:02:49 -0300 Subject: [PATCH 09/34] =?UTF-8?q?Update=20Desafios/Operadores=20Aritm?= =?UTF-8?q?=C3=A9ticos/desafio-operadores-aritmeticos-08.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gabriel Dalseco <55258427+GabrielCoruja@users.noreply.github.com> --- .../desafio-operadores-aritmeticos-08.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" index 996d9b1..f2fbd83 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-08.js" @@ -5,7 +5,7 @@ Escreva um algoritmo que recebe o valor de um prato, calcule e retorne o valor final dele acrescendo 10% de taxa por ser uma área turística e mais 5% de gorjeta para o garçon. Obs: Retornar um valor do tipo number com duas casa decimais. -Obs2: Dependendo do método usado para arredondar o tipo da sua variavél pode mudar, e aqui o retorno DEVE ser do tipo NUMBER. Talvez seja preciso converter para number ao final. +Obs2: Dependendo do método usado para arredondar o tipo da sua variável, o valor retornado pode mudar, e aqui o retorno DEVE ser do tipo NUMBER. Talvez seja preciso converter para number ao final. */ From 777f86a8403bfc1e6b6d322f87205a90cf301ae1 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 16:50:48 -0300 Subject: [PATCH 10/34] fix: primeiro teste de destructuring e hofs --- test/destructuringEHofs.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 35fa836..0826c6e 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -9,8 +9,8 @@ const { describe("Desafios de Destructuring e HOFs.", () => { describe("01 - Testando a Função getBandsInformation.", () => { - it("O retorno da função deve ser um array", () => { - expect(getBandsInformation()).toBe('object'); + it("Retorne true caso o retorno da função seja um array", () => { + expect(Array.isArray(getBandsInformation())).toBeTruthy(); }); it("O retorno da função deve ser o array esperado", () => { const expectedArray = [ From ef55198344a1640c5168478bf1391836555b840e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 16:54:09 -0300 Subject: [PATCH 11/34] add correctly object values --- test/destructuringEHofs.test.js | 38 +++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 0826c6e..21b1a1f 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -16,13 +16,47 @@ describe("Desafios de Destructuring e HOFs.", () => { const expectedArray = [ { bandName: 'Radiohead', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "In Rainbows", + rate: 100 + }, + { + name: "Kid A", + rate: 95 + }, + { + name: "OK Computer", + rate: 90 + }, + { + name: "Pablo Honey", + rate: 80 + } + ], genre: 'Rock', country: 'England' }, { bandName: 'Avenged Sevenfold', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "City of Evil", + rate: 99 + }, + { + name: "Avenged Sevenfold", + rate: 98 + }, + { + name: "Sounding the Seventh Trumpet", + rate: 95 + }, + { + name: "Diamonds in the Rough", + rate: 80 + } + ], genre: 'Hard Rock', country: 'United States' } From 6dcd5bd0aa9af43a94c7e9d056d113d2836ed4a7 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 16:56:24 -0300 Subject: [PATCH 12/34] fix: add typeof to expect arg and fix letter to string --- test/destructuringEHofs.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 21b1a1f..43e86b1 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -67,10 +67,10 @@ describe("Desafios de Destructuring e HOFs.", () => { describe("02 - Testando a Função getBestAlbuns.", () => { it("O retorno da função deve ser uma string", () => { - expect(getBestAlbuns()).toBe('string'); + expect(typeof getBestAlbuns()).toBe('string'); }); it("O retorno da função deve ser a tring esperado", () => { - const expectedString = 'Os Melhores álbuns do Radiohead: In Rainbows,Kid A,OK Computer,Pablo Honey' + const expectedString = 'Os melhores álbuns do Radiohead: In Rainbows,Kid A,OK Computer,Pablo Honey' expect(getBestAlbuns()).toEqual(expectedString); }); }); From 91b8fafb06245c01cc046c093bd7b1b5b5b8566d Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 16:58:21 -0300 Subject: [PATCH 13/34] fix: change typeof to boolean if is array --- test/destructuringEHofs.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 43e86b1..ffc0faf 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -76,8 +76,8 @@ describe("Desafios de Destructuring e HOFs.", () => { }); describe("03 - Testando a Função getBandsName.", () => { - it("O retorno da função deve ser um array", () => { - expect(getBandsName()).toBe('object'); + it("Retorne true caso o retorno da função seja um array", () => { + expect(Array.isArray(getBandsName())).toBeTruthy(); }); it("O retorno da função deve ser o array esperado", () => { const expectedArray = [ From cba30f8459e33463deab551f8fb552322c8450d0 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 17:03:44 -0300 Subject: [PATCH 14/34] fix: add typeof to test and add const to gabarito --- Desafios/Destructuring e HOFs/Gabaritos/1-6.js | 2 +- test/destructuringEHofs.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js index 9e329e5..e76a052 100644 --- a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js +++ b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js @@ -34,7 +34,7 @@ const getBandsName = () => { // 4 - Filtre e retorne um array apenas com o nome das bandas que são dos Estados Unidos const usaFilter = () => { - usaBands = data.bands.filter((band) => band.country = 'United States') + const usaBands = data.bands.filter((band) => band.country = 'United States') .map(({ bandName }) => bandName); return usaBands; diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index ffc0faf..3c3dffa 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -94,7 +94,7 @@ describe("Desafios de Destructuring e HOFs.", () => { describe("04 - Testando a Função usaFilter.", () => { it("O retorno da função deve ser um array", () => { - expect(usaFilter()).toBe('object'); + expect(typeof usaFilter()).toBe('object'); }); it("O retorno da função deve ser o array esperado", () => { const expectedArray = [ From cb9e43470360c3262fcb019fbecc51e39269e4f3 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 12 Sep 2022 18:26:03 -0300 Subject: [PATCH 15/34] fix: array validation --- test/destructuringEHofs.test.js | 128 ++++++++++++++++++++++++++++---- 1 file changed, 115 insertions(+), 13 deletions(-) diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index 3c3dffa..a682c57 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -111,54 +111,156 @@ describe("Desafios de Destructuring e HOFs.", () => { describe("05 - Testando a Função rockFilter.", () => { it("O retorno da função deve ser um array", () => { - expect(rockFilter()).toBe('object'); + expect(Array.isArray(rockFilter())).toBeTruthy(); }); - it("O retorno da função deve ser o array esperado", () => { - const expectedArray = [ +/* it("O retorno da função deve ser o array esperado", () => { + const expectedArray2 = [ { bandName: 'Radiohead', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "In Rainbows", + rate: 100 + }, + { + name: "Kid A", + rate: 95 + }, + { + name: "OK Computer", + rate: 90 + }, + { + name: "Pablo Honey", + rate: 80 + } + ], genre: 'Rock', country: 'England' }, { bandName: 'Avenged Sevenfold', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "City of Evil", + rate: 99 + }, + { + name: "Avenged Sevenfold", + rate: 98 + }, + { + name: "Sounding the Seventh Trumpet", + rate: 95 + }, + { + name: "Diamonds in the Rough", + rate: 80 + } + ], genre: 'Hard Rock', country: 'United States' }, { bandName: 'Arctic Monkeys', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "Humbug", + rate: 100 + }, + { + name: "AM", + rate: 99 + }, + { + name: "Favourite Worst Nightmare", + rate: 95 + }, + { + name: "Whatever People Say I Am, That's What I'm Not", + rate: 90 + } + ], genre: 'Indie Rock', country: 'England' }, { bandName: 'Pink Floyd', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "Wish You Were Here", + rate: 100 + }, + { + name: "Dark Side of the Moon", + rate: 100 + }, + { + name: "Animals", + rate: 100 + }, + { + name: "A Saucerful of Secrets", + rate: 98 + } + ], genre: 'Progressive Rock', country: 'England' }, { bandName: 'Foo Fighters', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "Wasting Light", + rate: 100 + }, + { + name: "Sonic Highways", + rate: 90 + }, + { + name: "Concrete and Gold", + rate: 90 + }, + { + name: "Echoes, Silence, Patience & Grace", + rate: 85 + } + ], genre: 'Rock', country: 'United States' }, { bandName: 'Red Hot Chili Peppers', - bestAlbuns: [[Object], [Object], [Object], [Object]], + bestAlbuns: [ + { + name: "Stadium Arcadium", + rate: 100 + }, + { + name: "Californication", + rate: 99 + }, + { + name: "By the Way", + rate: 97 + }, + { + name: "The Getaway", + rate: 95 + } + ], genre: 'Rock', country: 'United States' } ] - expect(rockFilter()).toEqual(expectedArray); - }); + expect(rockFilter()).toMatchObject(expectedArray2); + }); */ }); describe("06 - Testando a Função highestRatingFilter.", () => { - it("O retorno da função deve ser um array", () => { - expect(highestRatingFilter()).toBe('object'); + it("Retorne true caso o retorno da função seja um array", () => { + expect(Array.isArray(highestRatingFilter())).toBeTruthy(); }); it("O retorno da função deve ser o array esperado", () => { const expectedArray = [ From 94365b6e0ff0f62ceece269142c65ffb5c849e65 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 17:44:00 -0300 Subject: [PATCH 16/34] feat: update challenge 05 functions, test and rubric --- .../Destructuring e HOFs/Gabaritos/1-6.js | 6 +- .../Destructuring e HOFs/desafio-hofs-05.js | 2 +- test/destructuringEHofs.test.js | 152 ++---------------- 3 files changed, 14 insertions(+), 146 deletions(-) diff --git a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js index e76a052..f0fcde8 100644 --- a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js +++ b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js @@ -40,11 +40,11 @@ const usaFilter = () => { return usaBands; } -// 5 - Filtre e retorne um array com as informações das bandas que contenham 'Rock' no gênero musical +// 5 - Filtre e retorne um array com os nomes das bandas que contenham 'Rock' no gênero musical const rockFilter = () => { - const bandsGenre = data.bands.filter((band) => band.genre.includes('Rock')); - + const bandsGenre = data.bands.filter((band) => band.genre.includes('Rock')).map(band => band.bandName) + return bandsGenre } // 6 - Filtre e retorne um array com todos os álbuns que possuem nota igual a 100 diff --git a/Desafios/Destructuring e HOFs/desafio-hofs-05.js b/Desafios/Destructuring e HOFs/desafio-hofs-05.js index d7191ae..c18b0ed 100644 --- a/Desafios/Destructuring e HOFs/desafio-hofs-05.js +++ b/Desafios/Destructuring e HOFs/desafio-hofs-05.js @@ -1,6 +1,6 @@ const data = require('./data'); -// 5 - Filtre e retorne um array com as informações das bandas que contenham 'Rock' no gênero musical +// 5 - Filtre e retorne um array com os nomes das bandas que contenham 'Rock' no gênero musical const rockFilter = () => { diff --git a/test/destructuringEHofs.test.js b/test/destructuringEHofs.test.js index a682c57..7fd751d 100644 --- a/test/destructuringEHofs.test.js +++ b/test/destructuringEHofs.test.js @@ -113,149 +113,17 @@ describe("Desafios de Destructuring e HOFs.", () => { it("O retorno da função deve ser um array", () => { expect(Array.isArray(rockFilter())).toBeTruthy(); }); -/* it("O retorno da função deve ser o array esperado", () => { - const expectedArray2 = [ - { - bandName: 'Radiohead', - bestAlbuns: [ - { - name: "In Rainbows", - rate: 100 - }, - { - name: "Kid A", - rate: 95 - }, - { - name: "OK Computer", - rate: 90 - }, - { - name: "Pablo Honey", - rate: 80 - } - ], - genre: 'Rock', - country: 'England' - }, - { - bandName: 'Avenged Sevenfold', - bestAlbuns: [ - { - name: "City of Evil", - rate: 99 - }, - { - name: "Avenged Sevenfold", - rate: 98 - }, - { - name: "Sounding the Seventh Trumpet", - rate: 95 - }, - { - name: "Diamonds in the Rough", - rate: 80 - } - ], - genre: 'Hard Rock', - country: 'United States' - }, - { - bandName: 'Arctic Monkeys', - bestAlbuns: [ - { - name: "Humbug", - rate: 100 - }, - { - name: "AM", - rate: 99 - }, - { - name: "Favourite Worst Nightmare", - rate: 95 - }, - { - name: "Whatever People Say I Am, That's What I'm Not", - rate: 90 - } - ], - genre: 'Indie Rock', - country: 'England' - }, - { - bandName: 'Pink Floyd', - bestAlbuns: [ - { - name: "Wish You Were Here", - rate: 100 - }, - { - name: "Dark Side of the Moon", - rate: 100 - }, - { - name: "Animals", - rate: 100 - }, - { - name: "A Saucerful of Secrets", - rate: 98 - } - ], - genre: 'Progressive Rock', - country: 'England' - }, - { - bandName: 'Foo Fighters', - bestAlbuns: [ - { - name: "Wasting Light", - rate: 100 - }, - { - name: "Sonic Highways", - rate: 90 - }, - { - name: "Concrete and Gold", - rate: 90 - }, - { - name: "Echoes, Silence, Patience & Grace", - rate: 85 - } - ], - genre: 'Rock', - country: 'United States' - }, - { - bandName: 'Red Hot Chili Peppers', - bestAlbuns: [ - { - name: "Stadium Arcadium", - rate: 100 - }, - { - name: "Californication", - rate: 99 - }, - { - name: "By the Way", - rate: 97 - }, - { - name: "The Getaway", - rate: 95 - } - ], - genre: 'Rock', - country: 'United States' - } + it("O retorno da função deve ser o array com o nome de todas as bandas", () => { + const expectedArray = [ + 'Radiohead', + 'Avenged Sevenfold', + 'Arctic Monkeys', + 'Pink Floyd', + 'Foo Fighters', + 'Red Hot Chili Peppers' ] - expect(rockFilter()).toMatchObject(expectedArray2); - }); */ + expect(rockFilter()).toEqual(expectedArray); + }); }); describe("06 - Testando a Função highestRatingFilter.", () => { From 95995bf7976330086778d595c842a07cc4a20d7f Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 17:58:14 -0300 Subject: [PATCH 17/34] update rubric --- Desafios/Desafiadores/Gabaritos/11-16.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Desafios/Desafiadores/Gabaritos/11-16.js b/Desafios/Desafiadores/Gabaritos/11-16.js index b660538..e61bceb 100644 --- a/Desafios/Desafiadores/Gabaritos/11-16.js +++ b/Desafios/Desafiadores/Gabaritos/11-16.js @@ -52,6 +52,7 @@ function fibonnaci(n) { return fib[n - 1]; } +/* 14 - Soma de números primos */ function isPrimo(number) { if (number <= 1) return false; @@ -62,7 +63,6 @@ function isPrimo(number) { return true; } -/* 14 - Soma de números primos */ function sumPrimesNumbers() { let sum = 0; for (let index = 1; index <= 150; index += 1) { @@ -95,6 +95,8 @@ function meanFactorialFromAToB(a, b) { return parseFloat((sum / (b - a + 1)).toFixed(2)); } +/* 16 - Validação de CPF */ + function calcCpfFirstDigit(cpfArray) { const sum = cpfArray .slice(0, 9) @@ -116,7 +118,7 @@ function calcCpfSecondDigit(cpfArray) { return rest; } -/* 16 - Validação de CPF */ + function cpfValidator(cpf) { const cpfArray = cpf .replace(/[^0-9]/g, "") From 90c94ec8de644fab9812443ad8c005a57d2286cb Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 18:00:35 -0300 Subject: [PATCH 18/34] update param name --- Desafios/Desafiadores/desafiador-011.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Desafiadores/desafiador-011.js b/Desafios/Desafiadores/desafiador-011.js index e583863..009978c 100644 --- a/Desafios/Desafiadores/desafiador-011.js +++ b/Desafios/Desafiadores/desafiador-011.js @@ -42,7 +42,7 @@ Saída: */ -function musicalNotes3(notes){ +function musicalNotes3(arrNotes){ // Desenvolva seu código nessa função } From 727f280d43ccefba296a54354dfca35b2ebd0e0f Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 18:09:43 -0300 Subject: [PATCH 19/34] update rubric --- Desafios/Estruturas Condicionais/Gabaritos/1-10.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js index fe5b18b..0a62463 100644 --- a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js +++ b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js @@ -84,15 +84,15 @@ function robotFriend(mon, dad, me, brother, sister) { } /* 06 - Taxa Metabólica Basal */ -function basalMetabolicRate(age, sex, weight, heigh) { +function basalMetabolicRate(age, sex, weight, height) { let bmr; if (sex === "M") { - bmr = heigh * 6.25 + weight * 9.99 - age * 4.92 + 5; + bmr = height * 6.25 + weight * 9.99 - age * 4.92 + 5; } if (sex === "F") { - bmr = heigh * 6.25 + weight * 9.99 - age * 4.92 - 161; + bmr = height * 6.25 + weight * 9.99 - age * 4.92 - 161; } return `A taxa metabólica basal é: ${bmr} Kcal.`; From 3471b833cd841eef2487c8c08248791a7e2e2c67 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 18:16:36 -0300 Subject: [PATCH 20/34] fix: fix wrong function name export --- "Desafios/Estruturas de Repeti\303\247\303\265es/index.js" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/Desafios/Estruturas de Repeti\303\247\303\265es/index.js" "b/Desafios/Estruturas de Repeti\303\247\303\265es/index.js" index f98fd95..3a4753c 100644 --- "a/Desafios/Estruturas de Repeti\303\247\303\265es/index.js" +++ "b/Desafios/Estruturas de Repeti\303\247\303\265es/index.js" @@ -6,7 +6,7 @@ const numbersDivisibleBy3 = require('./desafio-estrutura-repeticoes-05'); const oddNumbers = require('./desafio-estrutura-repeticoes-06'); const findIndexOf = require('./desafio-estrutura-repeticoes-07'); const sortDec = require('./desafio-estrutura-repeticoes-08'); -const includesInArrays = require('./desafio-estrutura-repeticoes-09'); +const includesArrays = require('./desafio-estrutura-repeticoes-09'); module.exports ={ encode, @@ -17,5 +17,5 @@ module.exports ={ oddNumbers, findIndexOf, sortDec, - includesInArrays, + includesArrays, } From f9bb3a2be179fec2ee87138092f6bcbdbcf236fa Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 18:18:13 -0300 Subject: [PATCH 21/34] fix: add params to function --- .../desafio-estrutura-repeticoes-07.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Estruturas de Repeti\303\247\303\265es/desafio-estrutura-repeticoes-07.js" "b/Desafios/Estruturas de Repeti\303\247\303\265es/desafio-estrutura-repeticoes-07.js" index 8123d08..9dd7d1c 100644 --- "a/Desafios/Estruturas de Repeti\303\247\303\265es/desafio-estrutura-repeticoes-07.js" +++ "b/Desafios/Estruturas de Repeti\303\247\303\265es/desafio-estrutura-repeticoes-07.js" @@ -11,7 +11,7 @@ Caso não encontre o elemento, retorne: */ -function findIndexOf(){ +function findIndexOf(array, element){ // Desenvolva seu código nessa função } From 355d7f045509ef10e375132764e5fc925ade96b4 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Mon, 19 Sep 2022 18:20:21 -0300 Subject: [PATCH 22/34] remove console.log --- Desafios/Objetos/Gabaritos/1-5.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Desafios/Objetos/Gabaritos/1-5.js b/Desafios/Objetos/Gabaritos/1-5.js index 61ee582..52115c1 100644 --- a/Desafios/Objetos/Gabaritos/1-5.js +++ b/Desafios/Objetos/Gabaritos/1-5.js @@ -96,8 +96,6 @@ function fantasyGame3(className, level) { return `${role}, nível ${level}: ${totalLifePoints}PV, ${equipment}.`; } -console.log(fantasyGame3("Cavaleiro", 2)); - module.exports = { fantasyGame, fantasyGame2, From f69f20b7717e53a05d4e62fdb1ff694e0a020475 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 14:42:37 -0300 Subject: [PATCH 23/34] fix imc test --- test/operadoresAritmeticos.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/operadoresAritmeticos.test.js b/test/operadoresAritmeticos.test.js index 4f4a6a8..f557bab 100644 --- a/test/operadoresAritmeticos.test.js +++ b/test/operadoresAritmeticos.test.js @@ -116,7 +116,7 @@ describe("Desafios de Operadores Aritméticos.", () => { describe(" 06 - Testando a Função IMC.", () => { const height = +`1.${getRandomInt(40, 99)}` const weight = getRandomInt(40, 120); - const imc = weight / (height * height); + const imc = (height * height) / weight; it("Ao passar os argumentos 70 e 1.8 , deve retornar: 0.04628571428571429", () => { expect(IMC(70, 1.8)).toBe(0.04628571428571429); }); From d2ed26d504b368529fd497ef44b2bd5abe8bb81e Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 15:37:58 -0300 Subject: [PATCH 24/34] fix: import right function to test fahrenheitToCelsius --- "Desafios/Operadores Aritm\303\251ticos/index.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/index.js" "b/Desafios/Operadores Aritm\303\251ticos/index.js" index 7780f63..c916860 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/index.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/index.js" @@ -7,7 +7,7 @@ const IMC = require('./desafio-operadores-aritmeticos-06') const readingTime = require('./desafio-operadores-aritmeticos-07') const restaurantExpenses = require('./desafio-operadores-aritmeticos-08') const celsiusToFahrenheit = require('./desafio-operadores-aritmeticos-09') -const fahrenheitToCelsius = require('./desafio-operadores-aritmeticos-01') +const fahrenheitToCelsius = require('./desafio-operadores-aritmeticos-010') const paymentOptions = require('./desafio-operadores-aritmeticos-011') const weightAndValue = require('./desafio-operadores-aritmeticos-012') const randomRGBColor = require('./desafio-operadores-aritmeticos-013') From 460e691be34c0c8ddf0056c417487d26bba6ab02 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 15:40:44 -0300 Subject: [PATCH 25/34] fix: multiple functions in sequence --- .../Gabaritos/11-20.js" | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/Gabaritos/11-20.js" "b/Desafios/Operadores Aritm\303\251ticos/Gabaritos/11-20.js" index 3b51168..a078380 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/Gabaritos/11-20.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/Gabaritos/11-20.js" @@ -1,10 +1,4 @@ /* 11 - Loja de ração */ -function formatBrazilianMoney(number) { - const beforeComma = Math.floor(number); - let afterComma = Math.round(number * 100 - beforeComma * 100); - afterComma = afterComma !== 0 ? afterComma : `00`; - return `${beforeComma},${afterComma}`; -} function paymentOptions(price) { let inCash = price - price * 0.1; let creditCard = price + price * 0.15; @@ -17,12 +11,12 @@ function weightAndValue(priceKg, plateWeight) { return `O prato de ${plateWeight} gramas custa: R$ ${totalPrice}`; } +/* 13 - Cor aleatória */ function generateOneColor() { let uniqueColor = Math.floor(Math.random() * 256); return uniqueColor; } -/* 13 - Cor aleatória */ function randomRGBColor() { let finalColor = `rgb(${generateOneColor()}, ${generateOneColor()}, ${generateOneColor()})`; return finalColor; @@ -56,6 +50,13 @@ function randomBoolean() { } /* 17 - Financiamento de veículo */ +function formatBrazilianMoney(number) { + const beforeComma = Math.floor(number); + let afterComma = Math.round(number * 100 - beforeComma * 100); + afterComma = afterComma !== 0 ? afterComma : `00`; + return `${beforeComma},${afterComma}`; +} + function carFinancing(carPrice, entranceValue, quota) { let financing = carPrice - entranceValue; let tax = 0.05; From 6c377158f7ead0d96620094e183086310a044ccd Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 15:42:09 -0300 Subject: [PATCH 26/34] fix: rename function param --- .../desafio-operadores-aritmeticos-06.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-06.js" "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-06.js" index 9f1a2ba..a3732d1 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-06.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-06.js" @@ -12,7 +12,7 @@ Escreva o algoritmo usado por André para calcular seu próprio IMC e o retorne. */ -function IMC(base, height){ +function IMC(weight, height){ // Desenvolva seu código nessa função } From cbcbd64ec59ccb9b0f8653de140f9118ec4090e5 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 15:44:01 -0300 Subject: [PATCH 27/34] fix: rename function param --- .../desafio-operadores-aritmeticos-012.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-012.js" "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-012.js" index 3b1b6ef..0e1758f 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-012.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-012.js" @@ -15,7 +15,7 @@ Obs: O valor do prato tem que ter duas casas decimais após a virgula. */ -function weightAndValue(price, gram) { +function weightAndValue(priceKg, plateWeight) { // Desenvolva seu código nessa função } From 3f9df5013ffe6e677b053e462d3cf18bd5d79ddc Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 21 Sep 2022 15:44:34 -0300 Subject: [PATCH 28/34] fix: rename function param --- .../desafio-operadores-aritmeticos-014.js" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-014.js" "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-014.js" index 81f1fb0..72becb9 100644 --- "a/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-014.js" +++ "b/Desafios/Operadores Aritm\303\251ticos/desafio-operadores-aritmeticos-014.js" @@ -10,7 +10,7 @@ Escreva um algoritmo que recebe a duração total de uma viagem em minutos e ret */ -function timeTravel(minutes){ +function timeTravel(totalMinutes){ // Desenvolva seu código nessa função } From c3e3d5717e3abf268a8186afb4f653827210ab12 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo <59023543+cpwaldow@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:56:15 -0300 Subject: [PATCH 29/34] Update Desafios/Estruturas Condicionais/Gabaritos/1-10.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Caról SÌlva <42356399+caabeatriz@users.noreply.github.com> --- Desafios/Estruturas Condicionais/Gabaritos/1-10.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js index 0a62463..510be28 100644 --- a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js +++ b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js @@ -95,7 +95,7 @@ function basalMetabolicRate(age, sex, weight, height) { bmr = height * 6.25 + weight * 9.99 - age * 4.92 - 161; } - return `A taxa metabólica basal é: ${bmr} Kcal.`; + return `A taxa metabólica basal é: ${metabolicRate} Kcal.`; } /* 07 - Maior ou menor de idade */ From 49a69190b8f37028da90bd6fac1d4f7a0e2fb450 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo <59023543+cpwaldow@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:56:26 -0300 Subject: [PATCH 30/34] Update Desafios/Estruturas Condicionais/Gabaritos/1-10.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Caról SÌlva <42356399+caabeatriz@users.noreply.github.com> --- Desafios/Estruturas Condicionais/Gabaritos/1-10.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js index 510be28..7762df1 100644 --- a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js +++ b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js @@ -92,7 +92,7 @@ function basalMetabolicRate(age, sex, weight, height) { } if (sex === "F") { - bmr = height * 6.25 + weight * 9.99 - age * 4.92 - 161; + metabolicRate = height * 6.25 + weight * 9.99 - age * 4.92 - 161; } return `A taxa metabólica basal é: ${metabolicRate} Kcal.`; From cf3c8b3e8601927060fc4c837df724f1247ed0d2 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo <59023543+cpwaldow@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:59:32 -0300 Subject: [PATCH 31/34] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Caról SÌlva <42356399+caabeatriz@users.noreply.github.com> --- Desafios/Destructuring e HOFs/Gabaritos/1-6.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js index f0fcde8..73d76f2 100644 --- a/Desafios/Destructuring e HOFs/Gabaritos/1-6.js +++ b/Desafios/Destructuring e HOFs/Gabaritos/1-6.js @@ -44,7 +44,7 @@ const usaFilter = () => { const rockFilter = () => { const bandsGenre = data.bands.filter((band) => band.genre.includes('Rock')).map(band => band.bandName) - return bandsGenre + return bandsGenre; } // 6 - Filtre e retorne um array com todos os álbuns que possuem nota igual a 100 From a4a8fe891edd34d74643f19d3fea74320a47e9dd Mon Sep 17 00:00:00 2001 From: Carlos Eduardo <59023543+cpwaldow@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:00:31 -0300 Subject: [PATCH 32/34] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Caról SÌlva <42356399+caabeatriz@users.noreply.github.com> --- Desafios/Estruturas Condicionais/Gabaritos/1-10.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js index 7762df1..15d7c16 100644 --- a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js +++ b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js @@ -85,7 +85,7 @@ function robotFriend(mon, dad, me, brother, sister) { /* 06 - Taxa Metabólica Basal */ function basalMetabolicRate(age, sex, weight, height) { - let bmr; + let metabolicRate; if (sex === "M") { bmr = height * 6.25 + weight * 9.99 - age * 4.92 + 5; From 18e54277e7791c313b69298c5a2a117a27bef50c Mon Sep 17 00:00:00 2001 From: Carlos Eduardo <59023543+cpwaldow@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:00:37 -0300 Subject: [PATCH 33/34] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Caról SÌlva <42356399+caabeatriz@users.noreply.github.com> --- Desafios/Estruturas Condicionais/Gabaritos/1-10.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js index 15d7c16..62bfdbb 100644 --- a/Desafios/Estruturas Condicionais/Gabaritos/1-10.js +++ b/Desafios/Estruturas Condicionais/Gabaritos/1-10.js @@ -88,7 +88,7 @@ function basalMetabolicRate(age, sex, weight, height) { let metabolicRate; if (sex === "M") { - bmr = height * 6.25 + weight * 9.99 - age * 4.92 + 5; + metabolicRate = height * 6.25 + weight * 9.99 - age * 4.92 + 5; } if (sex === "F") { From 7461101ec7e5ff468d2659136352e0e2f0b67119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Daniel?= Date: Mon, 10 Oct 2022 22:38:14 -0300 Subject: [PATCH 34/34] =?UTF-8?q?Corre=C3=A7=C3=A3o=20enunciado=20desafio-?= =?UTF-8?q?strings-03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Desafios/Strings/desafio-strings-03.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Desafios/Strings/desafio-strings-03.js b/Desafios/Strings/desafio-strings-03.js index c183f02..c44d7ce 100644 --- a/Desafios/Strings/desafio-strings-03.js +++ b/Desafios/Strings/desafio-strings-03.js @@ -10,13 +10,13 @@ Entradas: "João","Carvalho', 25 Saída: -"Meu nome é João Carvalho e tenho 25 anos de vida" +"Meu nome é João Carvalho e tenho 25 anos de vida." --------------------------------------------------- */ function personalPresentation(firstName, lastName, age) { - // Desenvolva seu código nessa função + } module.exports = personalPresentation;