function delay(a) {
setTimeout(() => {
console.log(a);
}, 1000);
}
function prompt(a) {
console.log(a);
}
var temp = function() {
return new Promise((resolve) => {
delay('first');
resolve();
});
};
temp().then(() => {
prompt('second');
});
first, second 순으로 출력하려고 하는데,
second 부터 출력이됩니다.
delay()
, promt()
함수를 수정하지 않고 first second 순으로 출력할 수 있을까요?