javascript取精度并四舍五入

toFixed(num),num为你所需要的精度,会自动四舍五入

<script>
var result = 123.456789-12.3456789;
alert(result.toFixed(2))
</script>

相关推荐