jeudi 25 octobre 2018

JavaScript if condition not working even values are correct

product.batch['available_quantity']=parseInt(product.batch['available_quantity'] + total_added_quantity));

if(parseInt(total_added_quantity) > parseInt(product.batch['available_quantity'])){

This above code contain two variables one is total added quantity which conatin int value and has a type integer, the other variable is product.batch['available_quantity'] which contain int values but has type string so i has convert it into int by using parseInt. The issue is even when there is like 42>2 values of the mentioned variables in the if condition the if condition block not working instead else condition block is executed. What i am doing wrong please help me.

Aucun commentaire:

Enregistrer un commentaire