mercredi 28 avril 2021

Multiple if condtions in a single statement

I am trying to check if a username and userId exists and either a like or a comment exists then return something. And I am using two if conditions for this :

if (username && userID) {
  if (like || comment) {
    return something
  }
}

Is there any way to fit bot the conditions into one single statement. Also, here the username is immutable.

Aucun commentaire:

Enregistrer un commentaire