mardi 13 septembre 2016

is there a way to check if all the variables are empty? jquery

I am wondering if I have a bunch of variables and I want to check if all of them are empty strings other than keep on doing variable == "" || variable == "" is there is better way?

for example I have this below

var a = $('.a').val();
var b = $('.b').val();
var c = $('.c').val();

if((a == "") || (b == "") || (c == "")){
  //blah blah
}

Is there a way to shorten up the statement for if?

Thanks thanks in advance.

Aucun commentaire:

Enregistrer un commentaire