feature: resolve exercício 08-isAnagram

This commit is contained in:
Andrea Matsunaga 2022-11-01 13:34:35 -03:00
parent 25eb5d604a
commit b62457594a

View File

@ -1,4 +1,8 @@
export function isAnagram(word1, word2) {
// implementar logica aqui
if (word1.length != word2.length) return false
let sortedWord1Array = [...word1.toLowerCase()].sort()
let sortedWord2Array = [...word2.toLowerCase()].sort()
return (sortedWord1Array.join('') === sortedWord2Array.join(''));
}