You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open a Node.js environment or run a Node.js script.
Execute the following line of code: console.log("%d", 1.1);
How often does it reproduce? Is there a required condition?
The bug reproduces consistently with the given steps. The bug occurs in the Node.js runtime environment.
What is the expected behavior? Why is that the expected behavior?
According to the documentation of console.log and the JavaScript specification, the expected behavior is to log the value 1 when using the format specifier %d. The %d specifier is intended for printing integers, and it should be rounding it down.
What do you see instead?
Instead of printing 1, the Node.js environment logs 1.1
Additional information
The documentation of the console object in JavaScript, specifically on the Mozilla Developer Network (MDN), states that the %d specifier should be used to display integers. According to the documentation, it should result in rounding or truncation of floating-point numbers.
Reference: MDN - Using string substitutions
The incorrect behavior of console.log("%d", 1.1) in Node.js suggests a deviation from the expected behavior outlined in the documentation.
The text was updated successfully, but these errors were encountered:
Version
v19.8.1
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
No response
What steps will reproduce the bug?
Open a Node.js environment or run a Node.js script.
Execute the following line of code:
console.log("%d", 1.1);
How often does it reproduce? Is there a required condition?
The bug reproduces consistently with the given steps. The bug occurs in the Node.js runtime environment.
What is the expected behavior? Why is that the expected behavior?
According to the documentation of console.log and the JavaScript specification, the expected behavior is to log the value 1 when using the format specifier %d. The %d specifier is intended for printing integers, and it should be rounding it down.
What do you see instead?
Instead of printing 1, the Node.js environment logs 1.1
Additional information
The documentation of the console object in JavaScript, specifically on the Mozilla Developer Network (MDN), states that the %d specifier should be used to display integers. According to the documentation, it should result in rounding or truncation of floating-point numbers.
Reference: MDN - Using string substitutions
The incorrect behavior of console.log("%d", 1.1) in Node.js suggests a deviation from the expected behavior outlined in the documentation.
The text was updated successfully, but these errors were encountered: