Node.js examples for String:Algorithm
Is String Anagram
String.prototype.isAnagram = function(comparison) { var length = comparison.length - 1; for(var i = 0; i < this.length; i++) { if(this[i] != comparison[length - i]) { return 'not anagram'; }//from w w w . j a v a2 s .co m } return 'its an anagram!'; } var word = "Department"; var drow = "tnemtrapeD"; console.log(word.isAnagram(drow));