jeudi 8 août 2019

which coding style is faster? (javascript) [on hold]

here is the coding style of 1 I am checking the first condition if it is true returning it and if it is false checking the next condition and if it is true returning the control:

    if(condition1) {
    return

    }

    if(condition2) {

    return

    }

    if(condition3) {

    return

    }

    if(condition4) {

    return

    }

another way of writing here in single if loop I am checking the conditions with or and returning if any one is true:

    if(condition1 || condition2 || condition3 || condition4 ) {
    return;
    }

Aucun commentaire:

Enregistrer un commentaire