vendredi 14 juillet 2017

Shorthand for if( x == a || x == b) [duplicate]

Trying to call function navigate('home') if the section variable equals to 's1' or 's2'

this is my code :

if( section == 's1' || section == 's2' ){
    navigate('home') ;
}

Is there a shorthand way to do this

Thanks.

Aucun commentaire:

Enregistrer un commentaire