feat(08-isAnagram): Cria a função

This commit is contained in:
Leonardo Pereira Rocha 2022-11-02 14:23:55 -03:00
parent 25cbe458a0
commit e3706d5771
2 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,5 @@
export function fibonacci(value) {
//
let previous = 0;
let sum = 0;
let next = 1;

View File

@ -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;
}