Consider every point as starting point and search given word
for ( let row = 0 ; row < R ; row ++ ) { for ( let col = 0 ; col < C ; col ++ ) { if ( search2D ( grid , row , col , word ) ) document . write ( " " + row + " " + col + " " ) ; } } }