corrected the code and added indentation

This commit is contained in:
AnishTiwari 2018-09-18 12:59:07 +05:30 committed by GitHub
parent 8b2f83e6c7
commit 672e2864a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,20 +5,17 @@ var sorted1 = word1.split("").sort().join("");//SORTING WORD1
var sorted2 = word2.split("").sort().join(""); //SORTING WORD2 var sorted2 = word2.split("").sort().join(""); //SORTING WORD2
//COMPARING LENGTH AND CHECKING === //COMPARING LENGTH AND CHECKING ===
if (sorted1.length == sorted2.length && sorted1 === sorted2) { if (sorted1.length == sorted2.length && sorted1 === sorted2) {
return true; return true;
} }
else{ else{
return false; return false;
} }
} }
if(anagram(word1,word2)){ if(anagram("binary", "brainy")){
alert("AN ANAGRAM"); alert("AN ANAGRAM");
} }
else{ else{
alert("NOT AN ANAGRAM"); alert("NOT AN ANAGRAM");
} }
anagram("sasdas", "sdasda");