function which tells all cells are visited or not
function isAllCellTraversed ( grid ) { let visited = new Array ( grid . length ) ; for ( let i = 0 ; i < visited . length ; i ++ ) { visited [ i ] = new Array ( grid [ 0 ] . length ) ; } let total = grid . length * grid [ 0 ] . length ;