function job1() {
return new Promise(function (res, rej) {
console.log('p_1 start');
setTimeout(function () {
console.log('p_1 end');
res();
}, 2000);
});
}
function job2() {
return new Promise(function (res, rej) {
console.log('p_2 start');
setTimeout(function () {
console.log('p_2 end');
res();
}, 2000);
});
}
function job3() {
return new Promise(function (res, rej) {
console.log('p_3 start');
setTimeout(function () {
console.log('p_3 end');
res();
}, 2000);
});
}
/* ================================================ */
job1().then(function () {
return job2();
}).then(function () {
return job3();
});