dimanche 16 septembre 2018

Is there a syntactical way to shorten a long if conditional?

Is there a syntactical way to shorten a long if conditional like in the example below

if (invoice.get('status') !== 'claimed' && invoice.get('status') !== 'paid' && invoice.get('status') !== 'cancelled' )

to

if (invoice.get('status') !== 'claimed' && 'paid' && 'cancelled' )

or something like

if (invoice.get('status') !== 'claimed', 'paid', 'cancelled' )

Aucun commentaire:

Enregistrer un commentaire