How to escape promise during processing

Inho
Apr 23, 2021

Recently, I was interviewed by a company.

The interviewer asked me bunch of questions.

Most of them are easy to answer.

And One problem still comes me as being curious.

That is how to escape promise during processing.

I answered like ‘I guess we can use resolve or reject callback’

but he said “Yeah, you can use it. but resolve or reject is the result of promises, you want stop the async call”

And I can’t answer it anymore because I had no idea of it.

I googled the way of escaping promise when i came back home.

And I was shocked when I saw the answer.

throw new Error(‘Escaping Promise’);

Oh shit!!.. it was so easy and anybody can think of it.

--

--