forked from M3-Academy/challenge-algorithms-v2.0
feat(08-isAnagram): Cria a função
This commit is contained in:
parent
25cbe458a0
commit
e3706d5771
@ -1,4 +1,5 @@
|
||||
export function fibonacci(value) {
|
||||
//
|
||||
let previous = 0;
|
||||
let sum = 0;
|
||||
let next = 1;
|
||||
|
@ -1,4 +1,19 @@
|
||||
export function isAnagram(word1, word2) {
|
||||
// implementar logica aqui
|
||||
|
||||
let testWord1;
|
||||
let testWord2;
|
||||
|
||||
if (word1.length !== word2.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
testWord1 = word1.toLowerCase('').split('').sort().join('');
|
||||
testWord2 = word2.toLowerCase('').split('').sort().join('');
|
||||
|
||||
if (testWord1 === testWord2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user