<script>
var aa="20.6688";
var bb="10.5987";
var cc=Number(aa)+Number(bb)
function Number.prototype.toFixed2(decimalNum){
var multiplyValue=Math.pow(10,parseInt(decimalNum));
return (Math.round(multiplyValue*this))/multiplyValue;
}
alert(cc.toFixed(4))
alert(cc.toFixed2(3))
</script>
var aa="20.6688";
var bb="10.5987";
var cc=Number(aa)+Number(bb)
function Number.prototype.toFixed2(decimalNum){
var multiplyValue=Math.pow(10,parseInt(decimalNum));
return (Math.round(multiplyValue*this))/multiplyValue;
}
alert(cc.toFixed(4))
alert(cc.toFixed2(3))
</script>