Given this code, can I alter the behavior of the Stack Overflow snippet editor to make the console.log()
behave like Node.js?
var siUnits = [
{ symbol: "m", unit: "meter", quantity: "length"},
{ symbol: "k", unit: "kilogram", quantity: "mass"},
{ symbol: "s", unit: "second", quantity: "time"}
];
console.log(siUnits)
In Node.js the console output is formatted more compactly on just three lines shown below:
[ { symbol: 'm', unit: 'meter', quantity: 'length' },
{ symbol: 'k', unit: 'kilogram', quantity: 'mass' },
{ symbol: 's', unit: 'second', quantity: 'time' } ]
Note: the (as-of-yet unstandardized) console-object working group draft would allow use of a %O
"Formats the value as an expandable JavaScript Object". That doesn't work (yet) in stack-snippets.