lundi 29 août 2016

javascript, combining AND, OR in an if starement

I would like my code to be able to do the following;

IF (value1 is less than -1 AND variable2 does not equal either 6 or 5) then...

so far I can get a single if and to work as follows;

  if( (value < -1 && (day !== 6)) )  sendEmail(value)

but as soon as I add in the second or it falls over. What am I doing wrong? I have tried it in a few different ways but below are a couple of examples that did not work.

  if( (value < -1 && (day !== 6 || 5)) )  sendEmail(value)

  if( (value < -1 && (day !== 6 || day !== 5)) )  sendEmail(value)

Aucun commentaire:

Enregistrer un commentaire