When chaining Promises in AJAX calls, what is the purpose of returning another Promise inside a .then() method?
- To allow further chaining of asynchronous operations
- To terminate the Promise chain
- To handle synchronous operations within the Promise
- To trigger a catch block if an error occurs in the Promise chain
In JavaScript, returning a Promise inside a .then() allows for continued chaining of asynchronous operations. This enables better organization and readability of asynchronous code.
Loading...
Related Quiz
- How does error handling differ in async/await compared to traditional promise-based approaches?
- In ES6, a module imported via a relative path starting with ______ indicates it is located in the same directory.
- To iterate over an array's elements using a for...of loop, write for (const element _______ array).
- How does the Promise.all method interact with async/await?
- When exporting a class or function as a default export, it's not necessary to use the ________ keyword.