JS numeric calculation

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

 

Guess you like

Origin blog.csdn.net/lanqibaoer/article/details/82498023