Skip to content

Commit

Permalink
Merge pull request #140 from jeslyw/master
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
akshitagupta15june committed Oct 2, 2022
2 parents 4b36703 + 2dc5601 commit b3be6ac
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Strings/isAnagram.js
@@ -0,0 +1,20 @@
// Simple function that checks if two strings are anagrams. Returns true or false.

function isAnagram(a,b){
if (a.length !== b.length){
return false;
}
var counter = 0;
for (var i=0; i<a.length; i++){
for (var j=0; j<b.length; j++){
if (a.charAt(i) === b.charAt(j)){
counter++;
break;
}
}
}
if (counter === a.length){
return true;
} return false;

}

0 comments on commit b3be6ac

Please sign in to comment.