lundi 2 août 2021

JQuery two different conditions are true. How to execute first condition only if its already true?

Both of these conditions are true, what happen here is after the 1st condition it will automatically execute the other condition. I want to execute only the first condition if its true and disregard the other condition. Already tried with 'else if' but not getting my desired result.

var productType = 'virtual';

var customerCredits = '150';
var totalPrice = '100';

    if(productType == 'virtual'){
      //some statements
    }
    if(customerCredits>totalprice){
     //some statements

}

Aucun commentaire:

Enregistrer un commentaire