Suggestion: Option to remove single quotes from output of console.log
Closed this issue · 4 comments
As a follow-up suggestion to #266, could it be an option whether or not to show the output of console.log
as quoted?
I understand that this means losing syntax highlighting but sometimes I want to see the raw output without the quotes and syntax highlighting is not important.
For example, suppose I'm looping through some data and I want to console log the results to generate some CSV data:
const data = [
{ "teamId": "00001", "teamNo": 1, "teamName": "Team Foo", "userName": "John Doe", "points": 312.0, "rank": 1 },
{ "teamId": "00002", "teamNo": 2, "teamName": "Team Bar", "userName": "Jane Doe", "points": 311.0, "rank": 2 },
{ "teamId": "00003", "teamNo": 3, "teamName": "Team Baz", "userName": "Enola Holmes", "points": 272.0, "rank": 3 }
];
data.forEach(d => {
console.log(`${d.rank},${d.teamName},${d.userName},${d.points}`);
});
Generates the output:
'1,Team Foo,John Doe,312'
'2,Team Bar,Jane Doe,311'
'3,Team Baz,Enola Holmes,272'
Compared to running the same code at https://jsconsole.com generates:
1,Team Foo,John Doe,312
2,Team Bar,Jane Doe,311
3,Team Baz,Enola Holmes,272
The latter can easily be copied and pasted to create a CSV file, or directly into a spreadsheet app as CSV data where syntax highlighting doesn't matter.
@pvanb, thanks for raising this.
The example you've provided is an interesting use case that I hadn't considered before.
I'll have a think about this and get back to you.
I would definitely like this feature as well!
Definitely like this feature !
@pvanb @dan-farley @javier250369 this is now possible in the latest release of RunJS.
To do this, turn off output highlighting in the appearance settings.