Feature #1

Merged
WilliamSimao merged 11 commits from Feature into master 2022-11-01 00:09:34 +00:00
10 changed files with 77 additions and 10 deletions

View File

@ -1,4 +1,4 @@
export function greet(name) {
// implementar logica aqui
return "";
return `Hello ${name}`;
}

View File

@ -1,3 +1,4 @@
export function triangleArea(base, height) {
// your code here
return base * height / 2
}

View File

@ -1,4 +1,8 @@
export function maxValue(values) {
// implementar logica aqui
if(values.length === 0) {
return values.length;
}
return Math.max(...values)
}

View File

@ -1,4 +1,16 @@
export function fibonacci(value) {
// implementar logica aqui
let soma = 0;
let anterior = 0;
let proximo = 1;
for (let i = 0; i < value; i++) {
soma = anterior + proximo;
anterior = proximo;
proximo = soma;
}
return anterior;
}

View File

@ -1,4 +1,9 @@
export function isPrime(value) {
// implementar logica aqui
for (let i = 2; i < value; i++)
if (value % i === 0) {
return false;
}
return value > 1;
}

View File

@ -1,4 +1,4 @@
export function sum(values) {
// implementar logica aqui
return values.reduce((firstValue, secondValue) => firstValue + secondValue, 0)
}

View File

@ -1,4 +1,12 @@
export function sumEven(value) {
// implementar logica aqui
let soma = 0
for (let i = 0; i < value.length; i++) {
if (value[i] % 2 === 0) {
soma += value[i]
}
}
return soma;
}

View File

@ -1,4 +1,6 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
return word1.toLowerCase().split("").sort().join() === word2.toLowerCase().split("").sort().join();
}
}

View File

@ -1,4 +1,17 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
let max = 0;
let maxCaracter = "";
text.split('').forEach((caracter) => {
if (text.split(caracter).length > max) {
max = text.split(caracter).length;
maxCaracter = caracter;
}
});
return maxCaracter;
}

View File

@ -1,4 +1,26 @@
export function longestWords(words) {
// implementar logica aqui
}
let longestLength = 0;
let longestWords = [];
words.forEach(word => {
if (longestLength < word.length) {
longestLength = word.length;
} else {
longestLength;
}
});
words.forEach(word => {
if (word.length === longestLength) {
longestWords.push(word);
}
});
return longestWords;
}