function thenable(value) { return { then: function (onfulfill, onreject) { onfulfill(value); } }; } var promise = Promise.resolve(thenable('voila!')); promise.then(function(result) { console.log(result); }); // Console output: // voila!