Không, setTimeout(fn, 0) vẫn đưa callback vào macrotask queue, chạy sau khi call stack rỗng và tất cả microtasks xử lý xong.
- Thực tế delay tối thiểu thường là 4ms trong browser (HTML spec).
- Dùng queueMicrotask() nếu muốn chạy sớm hơn (sau sync code nhưng trước I/O).
No, setTimeout(fn, 0) still puts the callback in the macrotask queue, running after the call stack is empty and all microtasks have been processed.
- In practice the minimum delay is typically 4ms in browsers (HTML spec).
- Use queueMicrotask() if you want to run sooner (after sync code but before I/O).