The following snippet will produce an error in Chrome (and Safari) while it works in Firefox.
I\'d expect to have 2 numbers shown in javascript console, but in Chrom
Try utilizing deferred.resolveWith()
// a generic promise that return a random float
var makePromise = function() {
// set `this` to `window.console` ,
// pass arguments within array
return $.Deferred().resolveWith(window.console, [Math.random()]);
}
// This works in all browsers
makePromise().then(console.log)
//.then(function(d) {
// console.log(d);
//});
// This works in firefox only
makePromise().then(console.log);