Javascript examples for String Operation:String Reverse
Change and add method to String with prototype
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/*from w w w . j ava 2s.co m*/ String.prototype.reverse = function() { return Array.prototype.reverse.apply(this.split('')).join(''); } console.log("box".reverse()); }); </script> </head> <body> </body> </html>