ควิซ JavaScript: Promises

Promises are the foundation of asynchronous JavaScript. This quiz tests how a promise settles, what each .then() passes to the next one, how rejections skip ahead to .catch() and what .finally() does with values.

ปานกลาง 10 ข้อ ~6 นาที ผ่านที่ 80% Node.js 22

เลือกโหมด

กำลังเล่นแบบผู้เยี่ยมชม: เข้าสู่ระบบเพื่อเก็บ XP และ streak

ตัวอย่างคำถาม

ข้อ 1 จาก 10

What does this print?

const p = Promise.resolve(5);
console.log(typeof p, p instanceof Promise);
ดูเฉลย

B. object true A promise is an object, so typeof gives 'object'. Promise.resolve(5) wraps the value 5; you get the 5 only inside .then() or with await.

ควิซนี้มีเนื้อหาอะไรบ้าง

  • Promise states and settling only once
  • Values flowing through a .then() chain
  • Returning a promise from .then()
  • .catch() and .finally() in a chain
  • Forgetting to return a promise

คำถามที่พบบ่อย

ต้องมีบัญชีไหม?

ไม่ต้อง ใครก็เล่นได้ เข้าสู่ระบบเพื่อเก็บ XP, streak, เหรียญตรา และประวัติ

ทำซ้ำได้ไหม?

ได้ ระบบเก็บคะแนนที่ดีที่สุดไว้ และสลับคำถามกับตัวเลือกใหม่ทุกครั้ง