forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge-8): completed challenge' (#8) from feature/challenge-8 into develop
Reviewed-on: #8
This commit is contained in:
commit
d26209f861
@ -1,4 +1,18 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
// implementar logica aqui
|
||||||
|
if (!word1 || !word2) return { error: 'Not Found Words' };
|
||||||
|
|
||||||
|
function toLowerCase(word) {
|
||||||
|
return word.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toSortWord(word) {
|
||||||
|
return word.split('').sort().join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function toAnalyzing(word){
|
||||||
|
return toSortWord(toLowerCase(word))
|
||||||
|
}
|
||||||
|
|
||||||
|
return toAnalyzing(word1) === toAnalyzing(word2)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user