I'm parsing an existing HTML table on a webpage into an array of numbers to later pass to a plot object. I'm learning JavaScript and it is not clear how I am supposed to iterate over the data values in HTML tags. This is what I've come up with:
for (i = 0; i < table.rows.length; i += 1) {
row = table.rows[i];
for (j = 0; j < row.cells.length; j += 1) {
cell = row.cells[j];
coord[j] = Number(cell.innerText);
}
data[i] = coord.slice();
}
I'm bothered by the .innerText part. Is that the universal mechanism for iterating over the text elements in the <td>
tags?