feat(08-isAnagram): Adiciona função

This commit is contained in:
Emerson Fully 2022-10-29 17:27:17 -03:00
parent b74587fc2f
commit d32e6541d3

View File

@ -1,4 +1,10 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
const word1LowerCase = word1.toLowerCase();
const word2LowerCase = word2.toLowerCase();
const word1Sorted = word1LowerCase.split('').sort().join('');
const word2Sorted = word2LowerCase.split('').sort().join('');
return word1Sorted === word2Sorted;
}