Complete the code to create a new AbortController instance.
const controller = new [1]();The AbortController is used to create a controller that can abort fetch requests.
Complete the code to pass the abort signal to the fetch request.
fetch(url, { signal: [1].signal })The signal property of the AbortController instance is passed to fetch to enable cancellation.
Fix the error in the code to abort the fetch request correctly.
controller.[1]();The correct method to cancel a fetch request is abort() on the controller.
Fill both blanks to create a fetch request that can be cancelled.
const controller = new [1](); fetch(url, { signal: [2].signal });
First, create an AbortController instance, then pass its signal property to fetch.
Fill all three blanks to handle fetch cancellation with error catching.
const controller = new [1](); try { const response = await fetch(url, { signal: [2].signal }); } catch (error) { if (error.name === '[3]') { console.log('Fetch aborted'); } }
Create an AbortController, pass its signal to fetch, and catch the error named AbortError when aborted.