feat(challenge-8): completed challenge

This commit is contained in:
Henrique Santos Santana 2022-10-27 21:22:41 -03:00
parent cf4ef58cce
commit 29ec105dd3

View File

@ -1,4 +1,18 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
if (!word1 || !word2) return { error: 'Not Found Words' };
function toLowerCase(word) {
return word.toLowerCase();
}
function toSortWord(word) {
return word.split('').sort().join('');
}
function toAnalyzing(word){
return toSortWord(toLowerCase(word))
}
return toAnalyzing(word1) === toAnalyzing(word2)
}