scrimba
JS Challenges
Congrats on Finishing! (What's Next?)
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Congrats on Finishing! (What's Next?)
AboutCommentsNotes
Congrats on Finishing! (What's Next?)
Expand for more info
index.js
run
preview
console
function isAnagram(str1, str2){
//if(str1.length !== str2.length) return false;
if(typeof str1 !== "string" || typeof str2 !== "string") return false;
const newStr1 = str1.toLowerCase().split('').sort().join('').trim();
const newStr2 = str2.toLowerCase().split('').sort().join('').trim();

return newStr1 === newStr2;
}

//console.log(isAnagram("chin", "inch"));
//console.log(isAnagram(" night ", "thing"));
//console.log(isAnagram(34, "thing"));
//console.log(isAnagram("NigHt", "THING"));
//console.log(isAnagram("", ""));
Console
/index.html
-5:56