Skip to content

Wrong example #45048

Description

@vyatkin0

This example from the documentation (https://nodejs.org/api/process.html#when-to-use-queuemicrotask-vs-processnexttick)

import { nextTick } from 'node:process';
Promise.resolve().then(() => console.log(2));
queueMicrotask(() => console.log(3));
nextTick(() => console.log(1));
// Output:
// 1
// 2
// 3

doesn't work in Windows (node 16.13 and 18.11) and Ubuntu (node 18.11). Actual output is always

2
3
1

This looks like a documentation bug, but any explanation for this behavior in the main module would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions