const a = () => {
return new Promise(resolve => {
setTimeout(() => {
console.log(1)
resolve()
}, 1000)
})
}
const b = () => console.log(2)
a().then(() => { b() } )
//f1,2,3는 new Promise return 하는 함수
f1()
.then(f2)
.then(f3)
.then(f4)
.then(() => console.log("ok"))
'web > javascript' 카테고리의 다른 글
| callBack - errFunc (0) | 2026.01.13 |
|---|---|
| callback - Async, Await (0) | 2026.01.13 |
| JSON (0) | 2026.01.12 |
| 객체 정적 메소드 (0) | 2026.01.12 |
| 배열 메소드 (0) | 2026.01.12 |