2
所以有這個NodeJS模塊叫做console.table,你可以在控制檯裏添加表格。下面是從他們的網站的例子:NodeJs console.table中的forloop
// call once somewhere in the beginning of the app
require('console.table');
console.table([
{
name: 'foo',
age: 10
}, {
name: 'bar',
age: 20
}
]);
// prints
name age
---- ---
foo 10
bar 20
這僅僅是一個例子,我試圖把它在一個for循環將其自動化,我曾希望將工作的for循環和代碼是這樣的:
var values = [
]
for(var l = 0;l<config.accounts.username.length;l++) {
values.push([
{
username: "Number "+l,
itemtype: "Hello",
amount: 10
}, {
itemtype: "Hello",
amount: 10
}
]);
}
console.table("", values);
不幸的是,它不工作,有人可以幫助我嗎?
謝謝!
非常感謝! –