javascript – The calculation in JQuery gives the result "NaN"

function roundToTwo (num) {
return + (Math.round (num + "e + 2") + "e-2");
}


$ ("# quantity, #buy, #sell"). on ("change collage keyup", function () {
var quantity = Number ($ (& # 39; # quantity)) val ());
var buy = Number ($ ("# buy"). val ());
var sell = Number ($ ("# sell"). val ());


var total_amnt_trade = roundToTwo ((quantity * purchase) + (quantity * sale));
var brokerage_amnt_buy = ((buy * quantity) * 0.08) / 100;
if (brokerage_amnt_buy> = 25) {
var brokerage_buy = 25;
} other {
var brokerage_buy = brokerage_amnt_buy;
}
var brokerage_amnt_sell = ((sell * quantity) * 0.08) / 100;
if (brokerage_amnt_sell> = 25) {
var brokerage_sell = 25;
} other {
var brokerage_sell = brokerage_amnt_sell;
}
var brokerage = roundToTwo (brokerage_buy + brokerage_sell); //brokerage
var transaction_charges = roundToTwo ((((buy * quantity) + + (sell * quantity)) * 0,00325) / 100); // Transaction fees
var gst = roundToTwo ((((transaction_charges * 18) / 100) + (brokerage * 18) / 100)); // GST

var total_charges = roundToTwo (brokerage + transaction_charges + gst);
var pnl = roundToTwo (((sale - purchase) * quantity) - total_charges);

$ (# Pnl_display & # 39;) text (pnl);


})





Amount Buy To sell
Loss of profit