vendredi 17 juin 2016

Which is the most efficient way for a check?

I have a conditional statement as follows:

if(fields.length === 0){
 return false;
}

So, this returns false, if the length of the fields are zero. I can even make this check as follows:

if(!fields.length){
 return false;
}

Which way is more faster and efficient or it doesn't matter?

Any suggestions will be greatly appreciated. Thank you.

Aucun commentaire:

Enregistrer un commentaire