#anagram
1 messages · Page 1 of 1 (latest)
function Anagaram(str1, str2) {
const splited1 = str1.split("");
const splited2 = str2.split("");
}
im this far i got idea to split the comapre with include but
how do i compare if they both include same albhabeot
do i make new array with all letters and if they include that array = anagaram?
tf i asked question and answerd it my self
function Anagaram(str1, str2) {
const alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
const splited1 = str1.split(" ");
const splited2 = str2.split(" ");
if(splited1.includes(alphabet) === splited2.includes(alphabet)){
console.log("anagram")
}
}
Anagaram("listen", "silent")
IT WORKS
nvm
gotta make it so if it contais same eltters