forked from M3-Academy/challenge-algorithms-v2.0
feature/algoritimos #1
@ -1,4 +1,13 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
// 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;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user