I have a conditional statement in which I need to perform one of two operations, then continue after whichever operation has resolved. So my code currently looks as follows:
Save the promise and add the then after the if statement:
var promise; if (shoud_do_thing_a) { promise = do_thing_a(); } else { promise = do_thing_b(); } promise.then(more_code);