Feature #1

Merged
Gabriel_Bernardini merged 12 commits from Feature into master 2022-10-31 03:47:19 +00:00
10 changed files with 61 additions and 8 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 == 0 ) return 0
else {
return Math.max (...values)
}
}

View File

@ -1,4 +1,12 @@
export function fibonacci(value) {
// implementar logica aqui
let fib2 = 0
let fib1 = 1
let fibVal = 0
for (let i = 1; i <=value; i++){
fibVal = fib1 + fib2
fib2 = fib1
fib1 = fibVal
}
return fib2
}

View File

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

View File

@ -1,4 +1,8 @@
export function sum(values) {
// implementar logica aqui
let soma = 0
for (let i = 0; i < values.length; i++) {
soma += values[i];
}
return soma;
}

View File

@ -1,4 +1,10 @@
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
word1 = word1.toLowerCase().split('').sort().join('');
word2 = word2.toLowerCase().split('').sort().join('');
return word1 === word2;
}

View File

@ -1,4 +1,12 @@
export function mostUsedChar(text) {
// implementar logica aqui
return ""
const arr = text.split("");
let counts = {};
arr.forEach((count) => {
counts[count] = (counts[count] || 0) + 1;
});
const maxVal = Math.max(...Object.values(counts));
const num = Object.keys(counts).find((key) => counts[key] === maxVal);
return num;
}

View File

@ -1,4 +1,18 @@
export function longestWords(words) {
// implementar logica aqui
let bigword = "";
words.forEach(word => {
if(word.length > bigword.length){
bigword = word
}
});
const finalword = words.filter(word => {
if(word.length === bigword.length){
return word
}
});
return finalword
}