Node.js - Timers and Scheduling
How would you implement a fetch request in Node.js that automatically cancels if it does not complete within 2 seconds using
AbortController?AbortController?new AbortController() to create the controller.setTimeout to call controller.abort() after 2000ms.signal: controller.signal in fetch options to enable cancellation.finally to clear the timeout to avoid unnecessary aborts.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions