CALLBACK
3665 ワード
CALLBACK
const printString = (string, callback) => {
setTimeout(
() => {
console.log(string)
callback()
},
Math.floor(Math.random() * 100) + 1
)
}
const printAll = () => {
printString("A", () => {
printString("B", () => {
printString("C", () => {})
})
})
}
printAll() A,B,C
コールバックによって順序を決定できます.Reference
この問題について(CALLBACK), 我々は、より多くの情報をここで見つけました https://velog.io/@rlagudwog/CALLBACKテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol