feat(isAnagram): Implementacao da funcao isAnagram()

This commit is contained in:
Wellington Duarte Santos 2022-11-01 09:25:41 -03:00
parent 2d064c05b9
commit 0efd909b9c

View File

@ -1,4 +1,22 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui let test = word1.toUpperCase();
let original = word2.toUpperCase();
let tamanho1 = original.length;
let tamanho2 = test.length;
if(tamanho1 !== tamanho2){
return false;
}
let str1 = original.split('').sort().join('');
let str2 = test.split('').sort().join('');
if(str1 === str2){
return true;
}
else{
return false;
}
} }