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);
不幸的是,它不工作,有人可以帮助我吗?
谢谢!
非常感谢! –