for ( let [i,row] of [...mytab1.rows].entries() )
{
for( let [j,cell] of [...row.cells].entries() )
{
console.log(`[${i},${j}] = ${cell.innerText}`)
}
}
You may modify the prototype object of HTMLCollection (allowing to use in a way that resembles extension methods in C#) and embed into it a function that converts collection into array, allowing to use higher order funcions with the above style (kind of linq style in C#):
Better solution: use Javascript's native Array.from() and to convert HTMLCollection object to an array, after which you can use standard array functions.
You could also reference tr.rowIndex and cell.colIndex instead of using row_ind and col_ind.
I much prefer this approach over the top 2 highest-voted answers because it does not clutter your code with global variables i, j, row and col, and therefore it delivers clean, modular code that will not have any side effects (or raise lint / compiler warnings)... without other libraries (e.g. jquery).
If you require this to run in an old version (pre-ES2015) of Javascript, Array.from can be polyfilled.