I borrowed a piece of code for reversing a string in JavaScript. However it can't be done.
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>P4--Largest palindrome product</title> </head> <body> <!--A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. --> <script type="text/javascript"> var newdiv = document.createElement('div'); newdiv.innerHTML=Palindromic(); alert(Palindromic()); function Palindromic(){ var x; var a; var b; for(i=999*999;i>=100*100;i--) { x=i.toString(); if(x != x.reverse()) continue; else { for(j=100;j<999;j++) { if(i%j == 0) { var y =i/j; if(y>=100 && y<=999) { a=i;b=y; break; } } } } } return x; } String.prototype.reverse = function() { return this.split('').reverse().join(''); } </script> </body> </html> The error is "has no method 'reverse'".