Node.js examples for String:Algorithm
Is String Palindrome
String.prototype.isPalindrome = function() { var str = this; var half = parseInt(str.length / 2, 10); for (var i = 0, last = str.length - 1; i < half; ++i) { if (str[i] != str[last - i]) return false; }//from w w w .ja v a 2 s . c o m return true; };