1. 程式人生 > >JS 數值型 運算

JS 數值型 運算

function calculatePrice(){
			var price = new Number($('#price').val());
			var petroDiscount = new Number($('#petroDiscount').val());
			var merchantDiscount=new Number( $('#merchantDiscount').val());
			var hsDiscount = new Number($('#hsDiscount').val());
			var pp  ;
			pp = new Number(price - petroDiscount - merchantDiscount - hsDiscount).toFixed(2);
			console.log(price +"-" +petroDiscount +"-" + merchantDiscount +"-" +hsDiscount + "="+pp);
		}