Leetcode 2650. Design Cancellable Function
Run a generator that yields promises and return [cancel, promise] where each yielded promise's resolution or rejection is passed back into the generator via next/throw, and calling cancel() injects the string "Cancelled" as a thrown error to stop further execution. The returned promise should resolve with the generator's final value (or with the next yielded/returned value if a thrown error was caught) or reject with any uncaught error.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.