14 lines
343 B
JavaScript
14 lines
343 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// implementar logica aqui
|
|
if (word1.length !== word2.length) {
|
|
return false;
|
|
}
|
|
|
|
var str1 = word1.toLowerCase().toUpperCase().split('').sort().join('');
|
|
var str2 = word2.toLowerCase().toUpperCase().split('').sort().join('');
|
|
if (str1 === str2) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|