Often times, I and many other programmers have to deal with something similar to:
if (x === a || x === b || x === c || x === d) {
// Do assignment
}
where x
is an input that you are checking if it equals other variables, a
, b
, c
, d
. Sometimes the variable names are long. What's the best (or good way) to simplify this?
Aucun commentaire:
Enregistrer un commentaire