isAnagram
This commit is contained in:
parent
c85f7cec7f
commit
f669f37f27
@ -1,4 +1,12 @@
|
|||||||
export function isAnagram(word1, word2) {
|
export function isAnagram(word1, word2) {
|
||||||
// implementar logica aqui
|
word1 = word1.toUpperCase().split("").sort().join("");
|
||||||
|
word2 = word2.toUpperCase().split("").sort().join("");
|
||||||
|
return word1 === word2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(isAnagram("roma", "amor")); //(true)
|
||||||
|
console.log(isAnagram("Buckethead", "DeathCubeK")); //(true)
|
||||||
|
console.log(isAnagram("Twoo", "WooT")); //(true)
|
||||||
|
console.log(isAnagram("dumble", "bumble")); //(false)
|
||||||
|
console.log(isAnagram("ound", "round")); //(false)
|
||||||
|
console.log(isAnagram("apple", "pale")); //(false)
|
||||||
|
Loading…
Reference in New Issue
Block a user