feat(10): finished

This commit is contained in:
Matheus Brollo Dauter 2022-11-02 12:48:51 -03:00
parent c9e9d4a2e0
commit ac37e689f8
2 changed files with 12 additions and 3 deletions

View File

@ -5,7 +5,7 @@ export function mostUsedChar(text) {
let mostUsed = '';
text.split('').forEach((letter) => {
if (text.split(letter).length > maxLetter) {
maxLetter = text.split(letter).length - 1;
maxLetter = text.split(letter).length;
mostUsed = letter;
}
})

View File

@ -1,4 +1,13 @@
export function longestWords(words) {
// implementar logica aqui
return words.reduce((longest, sentence, i) => {
if (!i || longest[0].length < sentence.length) {
return [sentence];
}
if (longest[0].length === sentence.length) {
longest.push(sentence);
}
return longest;
}, []);
}