A staple in JQuery interview questions, be prepared to answer this one.   If you have to call several functions that return promises and take action only when all are completed, then $.when can be used. It provides a way to execute callback functions based on zero or more Thenable objects, usually Deferred objects that represent asynchronous events. The following is the syntax: jQuery.when(deferreds); Look at the following example: ar promises = [
$.ajax('http://google.com'),
$.ajax('http://yahoo.com'),
$.ajax('http://www.nytimes.com')
];
$.when.apply($, promises).then(
function(result1, result2, result3){
console.log('All URLs fetched.');
}
); The arguments passed to the thenCallbacks provide the resolved values for each of the Deferreds and match the order in the Deferreds were passed to jQuery.when().