From 7785a556026dae1956118226ab597156fd121213 Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 22:34:10 -0300 Subject: [PATCH 1/8] Create Triangulo n sei pq mas n consegui fazer esse ex usando console.log, acabei fazendo ele pelo script do html e usando document write --- Triangulo | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Triangulo diff --git a/Triangulo b/Triangulo new file mode 100644 index 0000000..3dec8b7 --- /dev/null +++ b/Triangulo @@ -0,0 +1,8 @@ + var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) + + for (let i = 0; i < linhas; i++) { + for (var j = 0; j <= (i+1); j++) { + document.write('#') + } + document.write('
') + } From 6e65915eac04da4aa541ec719f8ec7c16d2f43a0 Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 22:35:07 -0300 Subject: [PATCH 2/8] Rename Triangulo to Triangulo.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit coloquei a extensão do js --- Triangulo => Triangulo.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Triangulo => Triangulo.js (100%) diff --git a/Triangulo b/Triangulo.js similarity index 100% rename from Triangulo rename to Triangulo.js From b7f90e3b35e4add503fb20692f886e0d82ab4aa3 Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 22:36:09 -0300 Subject: [PATCH 3/8] Create Xadrez.js --- Xadrez.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Xadrez.js diff --git a/Xadrez.js b/Xadrez.js new file mode 100644 index 0000000..40f39b5 --- /dev/null +++ b/Xadrez.js @@ -0,0 +1,14 @@ +var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) + +for (let i = 0; i < linhas; i++) { + + var resultado = i % 2; + + if (resultado == 0) { + console.log('# # # # ') + } + else { + console.log(' # # # #') + } + console.log('\n') +} From f36fa2c7e18d8f0bb19003a828042e3fa77d6722 Mon Sep 17 00:00:00 2001 From: Prates Date: Fri, 21 Apr 2023 22:54:08 -0300 Subject: [PATCH 4/8] Commit dos exercicios de JS. --- JS/Caracteres.js | 16 ++++++++++++++++ JS/DeepEquals.js | 19 +++++++++++++++++++ JS/Diferente.js | 19 +++++++++++++++++++ JS/Intervalo.js | 14 ++++++++++++++ JS/Lista.js | 14 ++++++++++++++ JS/MaxMin.js | 31 +++++++++++++++++++++++++++++++ JS/Palindromo.js | 23 +++++++++++++++++++++++ JS/Recursividade.js | 15 +++++++++++++++ JS/Reverse.js | 8 ++++++++ JS/Triangulo.js | 8 ++++++++ JS/Xadrez.js | 14 ++++++++++++++ 11 files changed, 181 insertions(+) create mode 100644 JS/Caracteres.js create mode 100644 JS/DeepEquals.js create mode 100644 JS/Diferente.js create mode 100644 JS/Intervalo.js create mode 100644 JS/Lista.js create mode 100644 JS/MaxMin.js create mode 100644 JS/Palindromo.js create mode 100644 JS/Recursividade.js create mode 100644 JS/Reverse.js create mode 100644 JS/Triangulo.js create mode 100644 JS/Xadrez.js diff --git a/JS/Caracteres.js b/JS/Caracteres.js new file mode 100644 index 0000000..39289bc --- /dev/null +++ b/JS/Caracteres.js @@ -0,0 +1,16 @@ +var frase = prompt('Digite uma frase: ') +var char = prompt('Digite um caractere: ') + +function countChars(frase, c) { + var count = 0 + + for (let i = 0; i <= frase.length; i++) { + + if (frase[i] == c) { + count++ + } + } + return count +} + +console.log(countChars(frase, char)) \ No newline at end of file diff --git a/JS/DeepEquals.js b/JS/DeepEquals.js new file mode 100644 index 0000000..bd33201 --- /dev/null +++ b/JS/DeepEquals.js @@ -0,0 +1,19 @@ +function endereco(cidade, bairro, rua) { + this.cidade = cidade, + this.bairro = bairro, + this.rua = rua +} + +const end1 = new endereco('beaga', 'prates', 'daniel') +const end2 = new endereco('beaga', 'prates', 'daniel') + +function deepEquals(obj1, obj2) { +for (data in obj1 ) { + if( obj1[data] != obj2[data]){ + return false + } +} +return true +} + +console.log(deepEquals(end1,end2)) \ No newline at end of file diff --git a/JS/Diferente.js b/JS/Diferente.js new file mode 100644 index 0000000..7585c41 --- /dev/null +++ b/JS/Diferente.js @@ -0,0 +1,19 @@ +for (let i = 1; i <= 100; i++) { + + var resultadoT = i % 3; + var resultadoC = i % 5; + + if (resultadoT == 0 && resultadoC == 0) { + console.log('FizzBuzz') + } + else if(resultadoC == 0) + { + console.log('Fizz') + } + else if(resultadoT == 0){ + console.log('Buzz') + } + else{ + console.log(i) + } +} \ No newline at end of file diff --git a/JS/Intervalo.js b/JS/Intervalo.js new file mode 100644 index 0000000..599b679 --- /dev/null +++ b/JS/Intervalo.js @@ -0,0 +1,14 @@ +var minimo = Number.parseInt(prompt('Digite o numero minimo: ')) +var maximo = Number.parseInt(prompt('Digite o numero maximo: ')) +var interv = Number.parseInt(prompt('Digite um intervalo: ')) + +function range(max, min, intervalo) { + var numbers = new Array() + + for (let i = (min+1); i < max; i+= intervalo) { + numbers.push(i) + } + return numbers +} + +console.log(range(maximo, minimo, interv)) \ No newline at end of file diff --git a/JS/Lista.js b/JS/Lista.js new file mode 100644 index 0000000..1eb16e8 --- /dev/null +++ b/JS/Lista.js @@ -0,0 +1,14 @@ +function toList(array) { + if (array.length === 0) { + return null + } + else + { + return { + value: array[0], + rest: toList(array.slice(1)) + } + } +} + +console.log(toList([1, 2, 3])) \ No newline at end of file diff --git a/JS/MaxMin.js b/JS/MaxMin.js new file mode 100644 index 0000000..33b8dbf --- /dev/null +++ b/JS/MaxMin.js @@ -0,0 +1,31 @@ +var numA = Number.parseFloat(prompt('Digite um numero: ')) +var numB = Number.parseFloat(prompt('Digite um numero: ')) + +function min(a, b) { + + if (a < b) { + return a + } + else if (b < a){ + return b + } + else{ + return a + } + +} + +function max(a, b) { + if (a > b) { + return a + } + else if (b > a){ + return b + } + else{ + return a + } +} + +console.log(min(numA, numB)) +console.log(max(numA, numB)) \ No newline at end of file diff --git a/JS/Palindromo.js b/JS/Palindromo.js new file mode 100644 index 0000000..b2a6889 --- /dev/null +++ b/JS/Palindromo.js @@ -0,0 +1,23 @@ +var palavra = prompt('Digite uma palavra: ') + +var palindromo = palavra.split('').reverse().join('') + + // Usei essa função pra fazer e irei explicar abaixo o que cada classe faz + + // split: cria um array e coloca cada letra em uma posição (as aspas simples serve + // para que coloque as letras separadas no array, e não apenas a palavra inteira) + + // reverse: serve pra inverter a ordem das posições(letras) + + // join: faz o inverso do split, ele concatena as posições e forma apenas uma + // posição(as aspas simples serve para que não coloque nada entre as posições) + + + +if (palavra === palindromo) { + console.log('A Palavra é Palindromo') +} +else +{ + console.log('A palavra NÃO é Palindromo') +} \ No newline at end of file diff --git a/JS/Recursividade.js b/JS/Recursividade.js new file mode 100644 index 0000000..2211e50 --- /dev/null +++ b/JS/Recursividade.js @@ -0,0 +1,15 @@ +var number = Number.parseFloat(prompt('Digite um numero: ')) + +function mod2(number) { + + var resultadoNum = number % 2; + + if (resultadoNum == 0) { + return true + } + else if (resultadoNum != 0) { + return false + } +} + +console.log(mod2(number)) \ No newline at end of file diff --git a/JS/Reverse.js b/JS/Reverse.js new file mode 100644 index 0000000..b5371db --- /dev/null +++ b/JS/Reverse.js @@ -0,0 +1,8 @@ +lista = [1,2,3,4,5,6,7,8,9] + +function reverseArray(array) { + var arrayRev = array.reverse() + return arrayRev +} + +console.log(reverseArray(lista)) \ No newline at end of file diff --git a/JS/Triangulo.js b/JS/Triangulo.js new file mode 100644 index 0000000..5db3278 --- /dev/null +++ b/JS/Triangulo.js @@ -0,0 +1,8 @@ +var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) + +for (let i = 0; i < linhas; i++) { + for (var j = 0; j <= (i + 1); j++) { + document.write('#') // n sei pq mas n consegui fazer esse ex usando console.log + } + document.write('
') +} diff --git a/JS/Xadrez.js b/JS/Xadrez.js new file mode 100644 index 0000000..2b58990 --- /dev/null +++ b/JS/Xadrez.js @@ -0,0 +1,14 @@ +var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) + +for (let i = 0; i < linhas; i++) { + + var resultado = i % 2; + + if (resultado == 0) { + console.log('# # # # ') + } + else { + console.log(' # # # #') + } + console.log('\n') +} \ No newline at end of file From c3d91492428e68efdb12ee71befe237c21807a3b Mon Sep 17 00:00:00 2001 From: Prates Date: Fri, 21 Apr 2023 22:56:31 -0300 Subject: [PATCH 5/8] Create launch.json --- .vscode/launch.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..21b47bc --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use o IntelliSense para saber mais sobre os atributos possíveis. + // Focalizar para exibir as descrições dos atributos existentes. + // Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + + + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file From 9069a39c88a8e6ae17dd54e79cc6fd11009d35f5 Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 23:06:29 -0300 Subject: [PATCH 6/8] Delete Xadrez.js --- Xadrez.js | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Xadrez.js diff --git a/Xadrez.js b/Xadrez.js deleted file mode 100644 index 40f39b5..0000000 --- a/Xadrez.js +++ /dev/null @@ -1,14 +0,0 @@ -var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) - -for (let i = 0; i < linhas; i++) { - - var resultado = i % 2; - - if (resultado == 0) { - console.log('# # # # ') - } - else { - console.log(' # # # #') - } - console.log('\n') -} From ee8c217a7ab9fea5c51143afd08e5fd95645bd0d Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 23:06:39 -0300 Subject: [PATCH 7/8] Delete Triangulo.js --- Triangulo.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 Triangulo.js diff --git a/Triangulo.js b/Triangulo.js deleted file mode 100644 index 3dec8b7..0000000 --- a/Triangulo.js +++ /dev/null @@ -1,8 +0,0 @@ - var linhas = Number.parseInt(prompt('Digite a quantidade de linhas: ')) - - for (let i = 0; i < linhas; i++) { - for (var j = 0; j <= (i+1); j++) { - document.write('#') - } - document.write('
') - } From 7685eb88dbcac46027ffc9e06277c29d55eff757 Mon Sep 17 00:00:00 2001 From: Daprats <83983301+Daprats@users.noreply.github.com> Date: Fri, 21 Apr 2023 23:08:01 -0300 Subject: [PATCH 8/8] Delete .vscode directory --- .vscode/launch.json | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 21b47bc..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - // Use o IntelliSense para saber mais sobre os atributos possíveis. - // Focalizar para exibir as descrições dos atributos existentes. - // Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - - - { - "type": "chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:8080", - "webRoot": "${workspaceFolder}" - } - ] -} \ No newline at end of file