Comprehensive and Detailed Explanation From JavaScript Knowledge:
We have an array of plain objects:
[
{ name: 'John', email: '
[email protected]' },
{ name: 'Jane', email: '
[email protected]' },
{ name: 'Emily', email: '
[email protected]' }
]
We want:
A "visual representation" of the list.
Ability to sort by name or email in DevTools.
console.table:
console.table(data) renders data as a table in most browser devtools and Node consoles that support it.
Each object becomes a row; properties (name, email) become columns.
Many DevTools UIs allow:
Clicking column headers to sort by that column.
Filtering / viewing in a structured way.
So:
console.table(usersList);
Displays a sortable table of users by name or email. This matches the requirement exactly.
Other options:
console.group(usersList);
Starts a console group. The argument is just logged as a line label.
It does not create a table or sortable view; it just groups subsequent logs.
console.groupCollapsed(usersList);
Same grouping behavior, but collapsed by default.
Again, no table or sortable columns.
console.info(usersList);
Logs the array in the console, but as a standard log/info.
You can expand objects, but there is no table view or built-in column sorting.
Therefore, the correct method is:
Study Guide / Concept Reference (no links):
console.table for tabular logging
console.group and console.groupCollapsed for grouped logs
console.log / console.info standard logging behavior
DevTools UI support for sorting columns in console.table
________________________________________