forked from M3-Academy/challenge-algorithms-v2.0
13 lines
344 B
JavaScript
13 lines
344 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// 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;
|
|
}
|
|
} |