Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions 01-js/easy/anagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@
*/

function isAnagram(str1, str2) {

}
// both string are alredy defined in function so we have to sort these strings
str1=sortString(str1.tolowercase()); // decalred a function to sort characters of strings
str2=sortString(str2.tolowercase());
if(str1==str2){
return true;
}
else{
return false;
}
function sortString(str){
let charArray=str.split(''); // split function splits all characters in form of array
charArray.sort();// noe array of characters has been sorted
let ans=charArray.join(''); // all chracters rejoined to form new string
retrun ans;
}

module.exports = isAnagram;