答案 0 :(得分:5)
node.js版本v10.16.0
,您可以使用console.table
API而不安装任何节点模块。
const structDatas = [
{ handler: 'http', endpoint: 'http://localhost:3000/path', method: 'ALL' },
{ handler: 'event', endpoint: 'http://localhost:3000/event', method: 'POST' },
{ handler: 'GCS', endpoint: 'http://localhost:3000/GCS', method: 'POST' }
];
console.table(structDatas);
在终端中的标准输出是这样的:
答案 1 :(得分:0)
var values = [];
Array.forEach(function(b, i) {
values.push(
{
'Symbol': b.a,
'BID': b.b,
'CONVERT1': b.c,
'Buy': b.d,
'Sell': b.e,
'Convert2': b.f
});
});
console.table(values);
答案 2 :(得分:0)
我喜欢这个软件包,用于在终端上更新文本,而不是添加新行:https://github.com/ivanseidel/node-draftlog
答案 3 :(得分:-1)
console.table(["apples", "oranges", "bananas"]);
https://developer.mozilla.org/en-US/docs/Web/API/Console/table