var foo function myCallback new Promise function resolve reject do smt

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