Runs in a real DOM. Each test seeds a
<table id="people">with a<thead>and a<tbody>.
Implement sortTable(columnIndex, direction) that reorders the <tbody> rows by the text of the cell at columnIndex. direction is "asc" or "desc".
- If every value in the column parses as a number, compare numerically (so
9 < 31 < 110); otherwise compare as strings. - The sort must be stable: rows with equal keys keep their original relative order.
- Move the actual row elements - do not rebuild the table from strings.
Return the first-column text of every body row, in the new order, read back from the DOM.