What's wrong with this syntax for getting length of longest row in table?
<p>I have a table that is populated from a JSON object.  The result is a table with an uneven number of cells in each row.  I'm working on a script to automatically append empty cells to each row so that there is a uniform number.  My problem is figuring out the length of the longest row in the table.  Below is my attempt at this.  However, I keep getting errors that the row is undedefined (e.g. "cannot read property length of undefined").  What have I done wrong?</p>

<pre><code>function countCells() {
var columnCount;
$("#MarketsTable tr").each(function () {
    columnCount = Math.max(columnCount, $(this).cells.length);
})
return columnCount;
}
</code></pre>
