Skip to content

util.format not printing % when there's multiple arguments #13665

@naddison36

Description

@naddison36
  • v8.1.0:
  • Darwin MacBook-Pro.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64:
  • Subsystem:

The following code in node 6.10.3 prints percent: 10%, fraction: 0.1

console.log('percent: %d%, fraction: %d', 10, 0.1);

In node 8.1.0 it prints percent: 10 fraction: 0.1. Notice the % is no longer printed.

The following code gets back to the original node 6.10.3 output

console.log('percent: %d%%, fraction: %d', 10, 0.1);

Note the %% to print a single % in node 8

Also worth noting this problem doesn't happen if you are just printing one variable in node 8. The following code prints percent: 10%

console.log('percent: %d%', 10);

Should node 8 be formatting the same results as node 6? Or is this a functional change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions