forked from M3-Academy/challenge-algorithms-v2.0
14 lines
377 B
JavaScript
14 lines
377 B
JavaScript
export function isAnagram(word1, word2) {
|
|
// implementar logica aqui
|
|
let word1Lower = word1.toLowerCase()
|
|
let word2Lower = word2.toLowerCase()
|
|
if (word1Lower.length !== word2Lower.length) {
|
|
return false;
|
|
}
|
|
var string1 = word1Lower.split('').sort().join('');
|
|
var string2 = word2Lower.split('').sort().join('');
|
|
|
|
var result = (string1 === string2);
|
|
return result;
|
|
}
|