If condition doesn 't satisfy
if ( black < 2 * Math . max ( N , M ) ) { document . write ( " " ) ; return ; } let visited = [ ] ; for ( let i = 0 ; i < N ; i ++ ) { let temp = [ ] ; for ( let j = 0 ; j < M ; j ++ ) { temp . push ( false ) ; } visited . push ( temp ) ; }