//nodejs v4.2.6
function first(val){
var d=val+10;
console.log("first",d);
return d;
}
function second(val){
console.log("second",d);
function third(val){
console.log("third",d);
var promise=new Promise(function(data,reject){
data(20);
console.log("promise body");
})
promise.then(third).then(first).then(second).then(function(res){
console.log("promise call" ,res);
});
promise body third 30 first 40 second 50 promise call 50