forked from M3-Academy/challenge-algorithms-v2.0
feat(08-isAnagram): Adiciona função
This commit is contained in:
parent
b74587fc2f
commit
d32e6541d3
@ -1,4 +1,10 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
const word1LowerCase = word1.toLowerCase();
|
||||||
|
const word2LowerCase = word2.toLowerCase();
|
||||||
|
|
||||||
|
const word1Sorted = word1LowerCase.split('').sort().join('');
|
||||||
|
const word2Sorted = word2LowerCase.split('').sort().join('');
|
||||||
|
|
||||||
|
return word1Sorted === word2Sorted;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user