Skip to content

Instantly share code, notes, and snippets.

@noximus
Created August 15, 2020 14:13
Show Gist options
  • Save noximus/0623cea0c39b4b6d32b62367ad365a61 to your computer and use it in GitHub Desktop.
Save noximus/0623cea0c39b4b6d32b62367ad365a61 to your computer and use it in GitHub Desktop.
This is to show how to make a simple String Prototype for an anagram.
String.prototype.sortLetters = function() {
return this.toLowerCase().split('').sort().join('');
}
var isAnagram = function(test, original) {
return test.sortLetters() == original.sortLetters();
};
// This is to show how to make a simple String Prototype for an anagram.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment