vendredi 7 septembre 2018

Writing if/else statements with 3 conditions with a promise mixed in

So I have this conditional statement with 2 conditions, whereby

let something = this.props.something

if (condition1) {
  something = this.props.something(1)
} else if (condition2) {
  something = this.props.something(2)
}

This is where it's a little tricky to explain.

Now I want to add a 3rd condition, which happens only if both condition1 and condition2 are met, AND the outcome is ..filter(1).then(..filter(2)).

I know I would need to add a promise, but by any chance would adding something like this (below) to the conditional statement above work?

const combine12 = (this.props.something(1)).then(this.props.something(2))

  else if (do_something(a), do_something(b)) {
  something = combineAB
}

Aucun commentaire:

Enregistrer un commentaire