I found out today that Deferred.then(null,func) and Deferred.fail(func) aren't the same thing in JQuery. In ES6's promise, Promise.then(null,func) and Promise.catch(func) are the same thing, so I was confused by JQuery's functions.
The only difference I know of is this:
$.Deferred().reject().promise()
.fail(function(){
return $.Deferred().resolve().promise();
})
.then(function(){
console.log('fail caught error'); // NOT printed
});
$.Deferred().reject().promise()
.then(null,function(){
return $.Deferred().resolve().promise();
})
.then(function(){
console.log('then caught error'); //printed
});
Are there any other useful differences?