samedi 22 septembre 2018

Is there a way I can put more than one string in .includes for React Native?

Right now I have this going where if water or ocean is included in this.state then do this:

{this.state.ticket.includes('water') || this.state.ticket.includes('ocean') ?
// do something
:
// do something else
}

Is there a simplier way to put all the strings in .includes instead of repeating the same or code? Thank you!

Aucun commentaire:

Enregistrer un commentaire