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);
		}	
		

猜你喜欢

转载自blog.csdn.net/lanqibaoer/article/details/82498023
今日推荐