Skip to main content

Explain jQuery Deferred and Promise objects.

Mid JQuery
Quick Answer jQuery Deferred is a Promise-like object for managing async operations. $.Deferred() creates one; .resolve() fulfills it; .reject() fails it. .then(), .done(), .fail(), .always() attach callbacks. jqXHR (returned by $.ajax) implements Deferred, so you can: var req = $.ajax(url); req.done(fn); req.fail(fn). Useful for wrapping non-Promise async code.

Answer

Deferred object manages async workflow.
.resolve() / .reject() control completion.
.promise() allows chaining.
Useful for dependent AJAX flows.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice