Javascript String checkPalindrome()

Description

Javascript String checkPalindrome()




String.prototype.checkPalindrome = function(){
    var string = this.split('').join('').toLowerCase();
   var reverse = this.reverse();
  if(reverse === string) {
      return true;
  } else {//from   w  ww  .  ja v a2  s .c om
      return false;
  }
}
String.prototype.reverse = function(){
  string = this.split('').reverse().join('').toLowerCase();
  return string;
}
  

"blolb".checkPalindrome();



PreviousNext

Related