Feature #1

Merged
WilliamSimao merged 11 commits from Feature into master 2022-11-01 00:09:34 +00:00
Showing only changes of commit eac3bbdc0a - Show all commits

View File

@ -1,16 +1,6 @@
export function isAnagram(word1, word2) { export function isAnagram(word1, word2) {
// implementar logica aqui // implementar logica aqui
return word1.toLowerCase().split("").sort().join() === word2.toLowerCase().split("").sort().join();
const word2Arr = word2.toLowerCase().split('');
for(let i = 0; i < word1.length; i++) {
const index = word2Arr.indexOf(word1.toLowerCase()[i]);
if(index === -1) return false;
word2Arr.splice(index, 1);
}
return !word2Arr.length;
} }