admin 管理员组文章数量: 1086019
I am trying to display a string on multilines with \n
in the Postman Console. How can I do this?
Example:
var mystr='line\n another line\n another line';
console.log(mystr);
Expecting:
line
another line
another line
Getting:
lineanother lineanother line
Note: it is working as expected in Firefox scratchpad.
I am trying to display a string on multilines with \n
in the Postman Console. How can I do this?
Example:
var mystr='line\n another line\n another line';
console.log(mystr);
Expecting:
line
another line
another line
Getting:
lineanother lineanother line
Note: it is working as expected in Firefox scratchpad.
Share Improve this question edited Mar 22, 2018 at 16:38 Maak 5,0573 gold badges30 silver badges39 bronze badges asked Mar 22, 2018 at 7:48 mitul jainmitul jain 611 silver badge5 bronze badges 4-
Try
\\n
instead of\n
. – Teemu Commented Mar 22, 2018 at 7:49 - Tried: Result is : line\n another line\n another line – mitul jain Commented Mar 22, 2018 at 7:52
- maybe try '\r\n' – CodeCupboard Commented Mar 22, 2018 at 7:57
-
All of
\n
,\\n
,\r\n
do not have any effect in the Postman console. – bastelflp Commented Oct 17, 2018 at 17:25
4 Answers
Reset to default 2type 3 times console.log:
console.log('linea1');
console.log('linea2');
console.log('linea3');
You can print multiline text like this:
console.log("hello", '\n', "world");
Which will show up like this in console:
Postman console log not allowing to write string in next line #1477
Asked the same question on postman GitHub, I will update here once got the solution.
Thanks, @Danny Dainton :)
I don’t think that you can achieve this in the Postman console - maybe worth raising an issue on the Postman github project, is there isn’t one already.
I would have suggested doing the same thing as the ments, adding \n
works in every other console but this one, which is strange.
I think that the only way, at the moment, is just to add multiple console.log()
statements, to get your vars printing on new lines.
Another alternative is to put what you need into an array
- This is not ideal but would give you the information in the console, on separate lines.
本文标签: javascriptPostman console log not allowing to write string in next lineStack Overflow
版权声明:本文标题:javascript - Postman console log not allowing to write string in next line - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744056572a2525960.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论