DevToolBoxฟรี
บล็อก

เครื่องมือแสดง Event Loop ของ JavaScript

แสดง Event Loop ของ JavaScript พร้อม Call Stack, Task Queue และ Microtask Queue แบบโต้ตอบ

console.log("Start");

setTimeout(() => {
  console.log("setTimeout");
}, 0);

Promise.resolve().then(() => {
  console.log("Promise");
});

console.log("End");
ช้าเร็ว
ว่าง
Call Stack
(ว่าง)
Web APIs / Timer
(ว่าง)
Microtask Queue
(ว่าง)
Task Queue (Macrotask)
(ว่าง)
(ว่าง)
Call Stack
Microtask Queue
Task Queue (Macrotask)
Web APIs / Timer
Console Output

ทำความเข้าใจ Event Loop ของ JavaScript

Event Loop ของ JavaScript จัดการการทำงานแบบอะซิงโครนัส callback ของ setTimeout ไปที่ task queue ส่วน callback ของ Promise ไปที่ microtask queue

แนวคิดหลัก

  • Call Stack ทำงานโค้ดแบบซิงโครนัสก่อน
  • Microtask มีความสำคัญเหนือ Macrotask
  • ทุก Macrotask จะตามด้วย Microtask ทั้งหมด
  • Event Loop ตรวจสอบ Queue เมื่อ Stack ว่างเท่านั้น
  • Web API ทำงานนอก Main Thread

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

Event Loop คืออะไร?
Event Loop เป็นโมเดลการทำงานพร้อมกันของ JavaScript สำหรับการดำเนินการ I/O แบบไม่บล็อก
ความแตกต่างระหว่าง Microtask และ Macrotask?
Microtask (Promise.then) มีความสำคัญสูงกว่าและถูกประมวลผลระหว่าง Macrotask
ทำไม Promise.then ก่อน setTimeout?
callback ของ Promise เป็น Microtask ที่ถูกประมวลผลก่อน Macrotask
เกิดอะไรขึ้นเมื่อ Stack ว่าง?
Event Loop ประมวลผล Microtask ทั้งหมดก่อน จากนั้น Macrotask ถัดไป
ฟรีไหม?
ใช่ ฟรีทั้งหมด

เครื่องมือที่เกี่ยวข้อง

𝕏 Twitterin LinkedIn

ให้คะแนนเครื่องมือนี้

3.8 / 5 · 109 คะแนน

เครื่องมือเพิ่มเติม

{ }ตัวจัดรูปแบบ JSON.*ตัวทดสอบ Regex

อัปเดตข่าวสาร

รับเคล็ดลับการพัฒนาและเครื่องมือใหม่ทุกสัปดาห์

ไม่มีสแปม ยกเลิกได้ตลอดเวลา

Enjoy these free tools?

Buy Me a Coffee

How to Use

  1. Enter or paste your data in the input field
  2. Configure any options if available
  3. Click the action button to process
  4. Copy the result to your clipboard

Use Cases

  • Development and debugging workflows
  • Data format conversion
  • Code generation and formatting
  • Quick calculations and validation

FAQ

Is this Javascript Event Loop Visualizer tool free to use?
Yes, the Javascript Event Loop Visualizer tool is completely free. No registration or payment required.
Is my data secure?
Absolutely. All processing happens client-side in your browser. Your data never leaves your device or is sent to any server.
What formats does the Javascript Event Loop Visualizer tool support?
The tool supports all standard formats for IP address calculation. Check the tool interface for specific format options.

💬 User Feedback

Have suggestions or found a bug? Leave a message and we'll get back to you.
0/2000