• tabularData {any}
    • properties {string[]} 构造表的备用属性。

    尝试使用 tabularData(或使用 properties)的属性列和 tabularData 的行来构造一个表并记录它。 如果无法将其解析为表格,则回退到仅记录参数。

    1. // 这些不能解析为表格数据。
    2. console.table(Symbol());
    3. // Symbol()
    4. console.table(undefined);
    5. // undefined
    6. console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
    7. // ┌─────────┬─────┬─────┐
    8. // │ (index) │ a │ b │
    9. // ├─────────┼─────┼─────┤
    10. // │ 0 │ 1 │ 'Y' │
    11. // │ 1 │ 'Z' │ 2 │
    12. // └─────────┴─────┴─────┘
    13. console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
    14. // ┌─────────┬─────┐
    15. // │ (index) │ a │
    16. // ├─────────┼─────┤
    17. // │ 0 │ 1 │
    18. // │ 1 │ 'Z' │
    19. // └─────────┴─────┘