refactor: padroniza formatação do código #2

Merged
andreamatsunaga merged 1 commits from development into master 2022-11-01 17:38:59 +00:00
3 changed files with 12 additions and 12 deletions

View File

@ -1,10 +1,11 @@
export function isPrime(value) {
if (value <= 1) return false;
for (let divisor = 2; divisor <= Math.sqrt(value); divisor++) {
if (value % divisor === 0) {
return false
}
let valueSqrt = Math.sqrt(value);
for (let divisor = 2; divisor <= valueSqrt; divisor++) {
if (value % divisor === 0) return false;
}
return true
return true;
}

View File

@ -1,8 +1,8 @@
export function isAnagram(word1, word2) {
if (word1.length != word2.length) return false
if (word1.length != word2.length) return false;
let sortedWord1Array = [...word1.toLowerCase()].sort()
let sortedWord2Array = [...word2.toLowerCase()].sort()
let sortedWord1Array = [...word1.toLowerCase()].sort();
let sortedWord2Array = [...word2.toLowerCase()].sort();
return (sortedWord1Array.join('') === sortedWord2Array.join(''));
}

View File

@ -1,12 +1,11 @@
export function longestWords(words) {
let sortedWords = words.sort((a, b) => b.length - a.length);
let maxLength = sortedWords[0].length
let longestWords = []
let maxLength = sortedWords[0].length;
let longestWords = [];
for (let word of sortedWords) {
if(word.length != maxLength) break;
longestWords.push(word)
longestWords.push(word);
}
return longestWords;