How to find a table's column count using the DOM?

dom, html, javascript, jquery

Solution

I think you can use cells to calculate the column, assuming that the number of column of first row will be same for all

tablename.rows[0].cells.length;

Problem

For row count using DOM, we have tablename.rows.length to get number of rows, but we don't have 'cols.length' for column count. How can we find the number of columns (only using the DOM)?

Original source

Related problems