ENع
الدرس 19 · Async JavaScript

Callbacks and promises

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A callback is a function you hand to other code to call later; a promise is an object that stands for a value that is not ready yet. Follow ten real lines that wrap setTimeout in a promise and chain two .then calls: the script prints start and end at once, and half a second later the promise is fulfilled, its saved callbacks pass through the microtask queue, and the console prints got 1000.

12 دقيقة11 خطوات5 أسئلةIntermediate
شكل 19 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.