Skip to main content

Explain .promise() and .done() in animations.

Mid JQuery
Quick Answer .promise() on a jQuery collection returns a Promise that resolves when all queued effects on the elements complete. $("div").fadeIn(500).promise().done(function() { console.log("all faded in") }). .done() attaches a callback to a Deferred - fires when resolved. Together they enable "do this after all animations complete" without counting callbacks manually.

Answer

.promise() returns a deferred tied to queued animations.
.done() executes after all animations finish.
Useful for synchronizing multiple effects.
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