-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ambiguity in docs on console.log and util.format #6341
Comments
@nodejs/documentation |
Has anybody done some work on this issue? I would love to start contributing to this project and this seems like a good start. Is it possible to get help if needed? |
@nattelog If I recall correctly, no, nobody works on this. You can open a PR with a proposed additions to the doc and we can have all the discussion/corrections there, also you can ask any preliminary questions here. |
@vsemozhetbyt I do not quite understand the ambiguity here or how your test code confirms it. What are your expected outputs from the test? For me (given a quick look) it seems legit? Or what am I missing? |
@nattelog I mean the doc probably should warn that output depends not only on a format of a first string but also on that if it is a string at all. |
If I get it right, we have 3 cases with arguments:
> console.log('str%d', 1);
str1
> console.log('str', 1);
str 1
> console.log(1, 'str');
1 'str' |
Here is a fragment from
console
docs:Here is a slightly different fragment from
util
docs:However, the behavior of both functions differs not only due to a presence of
%
elements in the string. According to the code (if I get it right), the behavior diverges due to merelytypeof
of the first argument.Here is a test code with output confusing for the naive reader (including me):
The output:
The first block shows the elements for future concatenation. The second and third ones show the output of differently disposed arguments, with none of the strings containing the
%
format elements.The text was updated successfully, but these errors were encountered: