feat(home): resolucao da questao 8
This commit is contained in:
parent
b377f7a9d6
commit
446222dffb
@ -1,4 +1,18 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
let arrayTest = word1.toLowerCase().split('').sort();
|
||||||
|
let arrayOriginal = word2.toLowerCase().split('').sort();
|
||||||
|
|
||||||
|
let palavraTest = arrayTest.toString();
|
||||||
|
let palavraOriginal = arrayOriginal.toString();
|
||||||
|
|
||||||
|
if(arrayTest.length === arrayOriginal.length){
|
||||||
|
if(palavraTest === palavraOriginal){
|
||||||
|
return true
|
||||||
|
}else{
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user