Javascript examples for String Operation:String Convert
Convert String to Float up to 2 Decimal places
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*ww w . j a v a 2 s.c om*/ Number.prototype.toString = function(){ return this.toFixed(2); } var oneone = new Number( 1.1 ); // since implicit conversion to string is required it will show 1.10 console.log( oneone ); } </script> </head> <body> </body> </html>