Skip to content

feat(runtime): implement console.table()#4745

Closed
nullptr-cve wants to merge 1 commit intoboa-dev:mainfrom
nullptr-cve:feat/console-table
Closed

feat(runtime): implement console.table()#4745
nullptr-cve wants to merge 1 commit intoboa-dev:mainfrom
nullptr-cve:feat/console-table

Conversation

@nullptr-cve
Copy link

Summary

Implements console.table(tabularData, properties?) per the WHATWG console spec.

Behaviour

  • Renders an ASCII box-drawing table with an (index) column plus one column per object property
  • Arrays of primitives use a Values column
  • The optional properties argument filters which columns are shown
  • Falls back to console.log behaviour when tabularData is not an object
  • Uses Object.keys() to enumerate only enumerable own properties (correctly excludes e.g. Array.prototype.length)

Example

console.table([{name: "Alice", age: 30}, {name: "Bob", age: 25}])
┌─────────┬───────┬─────┐
│ (index) │ name  │ age │
├─────────┼───────┼─────┤
│    0    │ Alice │ 30  │
│    1    │  Bob  │ 25  │
└─────────┴───────┴─────┘

Test plan

  • console_table_array_of_primitives
  • console_table_array_of_objects
  • console_table_with_properties_filter
  • console_table_non_object_fallback

Adds `console.table(tabularData, properties?)` per the WHATWG console
spec. Renders an ASCII box-drawing table to the logger with an
`(index)` column plus one column per object property. For arrays of
primitives, uses a `Values` column.

The optional second argument filters which columns are shown.
Falls back to `console.log` behaviour when `tabularData` is not an
object.

Includes four tests covering: array of primitives, array of objects,
column filtering, and primitive fallback.
@nullptr-cve nullptr-cve requested a review from a team as a code owner February 27, 2026 02:09
@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,504 49,504 0
Ignored 2,262 2,262 0
Failed 1,096 1,096 0
Panics 0 0 0
Conformance 93.65% 93.65% 0.00%

@jedel1043
Copy link
Member

Duplicate of #4690

@jedel1043 jedel1043 marked this as a duplicate of #4690 Feb 27, 2026
@jedel1043 jedel1043 closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants