Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exerciciosFeitos #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added JS/AltaOrdem/criptografia.js
Empty file.
Empty file added JS/AltaOrdem/funcMatriciais.js
Empty file.
Empty file added JS/AltaOrdem/ordenacao.js
Empty file.
Empty file added JS/AltaOrdem/transfString.js
Empty file.
Empty file added JS/AltaOrdem/verificNum.js
Empty file.
16 changes: 16 additions & 0 deletions JS/ConceitosB/fizzAndBuzz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function fizzBuzz(){
const numMax = 100;
for(i = 1; i <= numMax; i++){
if(i % 3 == 0 && i % 5 == 0){
console.log("FizzBuzz");
} else if(i % 5 == 0){
console.log("Buzz");
} else if(i % 3 == 0){
console.log("fizz");
} else{
console.log(i);
}
}
}

fizzBuzz();
11 changes: 11 additions & 0 deletions JS/ConceitosB/palindromo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function palindromo(){
let palavra = prompt("Digite uma palavra para verificar se é palindromo: ");
palavra = palavra.toLocaleLowerCase().replace(/\s/g, '');
let arvalap = palavra.split('').reverse().join('');
if(palavra === arvalap){
console.log("A palavra " + palavra + " é um palíndromo!");
} else{
console.log("A palavra " + palavra + " não né um palíndromo pos ao contrário fica: " + arvalap);
}
}
palindromo();
12 changes: 12 additions & 0 deletions JS/ConceitosB/triangulo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function triangulo() {
let nLinhas = 5;
for (i = 0; i < nLinhas; i++) {
let linha = "";
for (j = 0; j <= i; j++) {
linha = linha + "#";
}
console.log(linha);
}
}

triangulo();
14 changes: 14 additions & 0 deletions JS/ConceitosB/xadrez.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function xadrez(){
let quantLinhas = prompt("Digite a quantidade de linhas do xadrez: ");
let horizontal = "# # # #";

for(i = 1; i <= quantLinhas; i++){
if(i % 2 == 0){
console.log(" " + horizontal);
} else{
console.log(horizontal);
}
}
}

xadrez();
8 changes: 8 additions & 0 deletions JS/Functions/contandoChar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function countChars(frase, c){
return frase.split(c).length - 1;
}

let frase = prompt("Frase: ");
let c = prompt("Caractere a ser contado: ");

console.log(countChars(frase, c));
21 changes: 21 additions & 0 deletions JS/Functions/minAndMax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function min(a, b){
if(a < b){
console.log("O menor elemento é: " + a);
} else{
console.log("O menor elemento é: " + b);
}
}

function max(a, b){
if(a > b){
console.log("O maior elemento é: " + a);
} else{
console.log("O maior elemento é: " + b);
}
}

let a = prompt("Digite o num1: ");
let b = prompt("Digite o num2: ");

min(a, b);
max(a, b);
25 changes: 25 additions & 0 deletions JS/Functions/recursividade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function mod2(number){
if (number % 2 === 0) {
return true;
} else {
return false;
}
}

function mod(num, mod){
if (num % mod === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deveria ser recursivo

return true;
}else {
return false;
}
}

console.log(mod2(1));
console.log(mod2(2));
console.log(mod2(3));
console.log(mod2(4));

console.log(mod(1, 0));
console.log(mod(1, 2));
console.log(mod(10, 5));
console.log(mod(10, 8));
31 changes: 31 additions & 0 deletions JS/ObjArrays/deepEquals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function deepEquals(obj1, obj2) {
if (typeof obj1 === "object" && typeof obj2 === "object") {
if (obj1 === null && obj2 === null)
return true;

if (obj1 === null || obj2 === null)
return false;

if (Object.keys(obj1).length !== Object.keys(obj2).length)
return false;

for (let prop in obj1) {
if (!deepEquals(obj1[prop], obj2[prop]))
return false;
}
return true;
}
return obj1 === obj2;
}

let obj1 = {
nome: "Raphael",
idade: 30,
};

let obj2 = {
nome: "Raphael",
idade: 30,
};

console.log(deepEquals(obj1, obj2))
8 changes: 8 additions & 0 deletions JS/ObjArrays/intervalos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function range(min, max) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faltou o intervalo

let array = [];
for (i = min; i <= max; i++) {
array.push(i);
}
return array
}
console.log(range(1, 20));
10 changes: 10 additions & 0 deletions JS/ObjArrays/listas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function reverseArray(array){
let reversed = [];
for(let i = 0; i < array.length; i++){
reversed.push(parseInt(array[array.length - (i + 1)]));
}
return reversed;
}

let seq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
console.log(reverseArray(seq));
12 changes: 12 additions & 0 deletions JS/ObjArrays/revertArray.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function reverseArray(array){
let reversed = [];

for(let i = 0; i < array.length; i++){
reversed.push(parseInt(array[array.length - (i + 1)]));
}

return reversed;
}

let array = [1, 2, 3, 4, 5];
console.log(reverseArray(array));