vendredi 15 mars 2019

What's the performance difference between "skip if condition" and "directly return"?

Is there any performance difference between the following 2 functions:

function a() {
    var a = false;
    if(a) {
           ... Many lines, e.g. 1 million lines ...
    }
}

function b() {
    var a = false;
    if (a != true) {
        return;
    }
 }

Which one has smaller execution time?

Aucun commentaire:

Enregistrer un commentaire