Line #12, it says return Post.findByIdAndRemove(postId).
I was always under the impression that once you invoke the "return" dynamic, you're exiting the flow of the code at that point. Yet, in this case, it proceeds to the next "then" clause.
Why?
The code works, but I want to know why the continues to the next "then" clause despite the fact that there's a "return" dynamic in place.
the question is : how do we send something to the next "executor" parameter
the answer is : use return
something : Post.findByIdAndRemove(postId) next "executor" parameter : result
Bruce Gust
ASKER
So, my confusion, then, stems from the fact that I'm looking at "return" in the context of a conventional function as opposed to the way it's being used her in the context of a callback / promise, yes?
I get it! So the "return" is not functioning any differently than it normally does in that it still a "disruption." But because it's happening in the context of several functions chained together, the "disruption" is routed to the next link in the chain as opposed to it forcing the trajectory of the code outside the method as a whole.
the question is : how do we send something to the next "executor" parameter
the answer is : use return
something : Post.findByIdAndRemove(pos
next "executor" parameter : result