const isAnagram = (str1, str2) => {
const str2Arr = str2.split('');
for(let i = 0; i < str1.length; i++) {
const index = str2Arr.indexOf(str1[i]);
if(index === -1) return false;
str2Arr.splice(index, 1);
}
return !str2Arr.length;
}
console.log(isAnagram("abba","bbaa"))