1 2 3 4 5 6 7 8 9
var foo = function(){ p = new Promise(function(resolve, reject){ //do smth resolve(result); }; p.then(function(result){ console.log(result); }); }