feat(isAnagram): adicionando resolucao desafio 8

isAnagram
This commit is contained in:
Bernardo Cunha Ernani Waldhelm 2022-10-28 13:53:19 -03:00
parent a51c45d47c
commit 78aaef7f2f

View File

@ -1,4 +1,13 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui // implementar logica aqui
let array = word1.toLowerCase().split('').sort();
let array2 = word2.toLowerCase().split('').sort();
if (word1.length !== word2.length) {
return false;
} else {
if (array.toString() === array2.toString()) {
return true;
} else return false;
}
} }