function cellClicked(i, j) {
    if (GAMEOVER) return
    var cell;
    if (gBoard[i][j].isMine) {
        gBoard[i][j].isShown = true;
        renderBoard(gBoard); // @CR: why call render board here if you are calling it at the end of the func?


        checkGameOver()

    }

    if (gBoard[i][j] !== MINES && !GAMEOVER) { // @CR: no need to check game over, you did it at line 153
        gBoard[i][j].isShown = true;
        renderBoard(gBoard); // @CR: why call render board here if you are calling it at the end of the func anyways?
        cell = gBoard[i][j];
    }
    else if (gBoard[i][j].isMine === true) { // @CR: no need for "===true", you can just if (gBoard[i][j].isMine === true)
        gBoard[i][j].isShown = false;
        gGame.isOn = false
        gGame.isWin = false
    }
    if (!firstClick) { // @CR: this condition is a bit confusing, if firstClick === false then we are now doing the first click
        // @CR: thats why you should call it "isFirstClick", then if its true, it is pretty obvious we are in first click
        expandShown(gBoard, cell, i, j)
        setMines()
        setMinesNegsCount(gBoard)
        startGame()
    }

    firstClick = true
    renderBoard(gBoard)
}
// Called when a cell (td) is clicked 
Called when a cell (td) is clicked
Called when a cell ( td ) is clicked
function cellClicked(i, j) {
    if (GAMEOVER) return
    var cell;
    if (gBoard[i][j].isMine) {
        gBoard[i][j].isShown = true;
        renderBoard(gBoard); 
        checkGameOver()
    }
    if (gBoard[i][j] !== MINES && !GAMEOVER) { 
        gBoard[i][j].isShown = true;
        renderBoard(gBoard); 
        cell = gBoard[i][j];
    }
    else if (gBoard[i][j].isMine === true) { 
        gBoard[i][j].isShown = false;
        gGame.isOn = false
        gGame.isWin = false
    }
    if (!firstClick) { 
        expandShown(gBoard, cell, i, j)
        setMines()
        setMinesNegsCount(gBoard)
        startGame()
    }
    firstClick = true
    renderBoard(gBoard)
}
function cellClicked ( i , j ) { if ( GAMEOVER ) return var cell ; if ( gBoard [ i ] [ j ] . isMine ) { gBoard [ i ] [ j ] . isShown = true ; renderBoard ( gBoard ) ; checkGameOver ( ) } if ( gBoard [ i ] [ j ] !== MINES && ! GAMEOVER ) { gBoard [ i ] [ j ] . isShown = true ; renderBoard ( gBoard ) ; cell = gBoard [ i ] [ j ] ; } else if ( gBoard [ i ] [ j ] . isMine === true ) { gBoard [ i ] [ j ] . isShown = false ; gGame . isOn = false gGame . isWin = false } if ( ! firstClick ) { expandShown ( gBoard , cell , i , j ) setMines ( ) setMinesNegsCount ( gBoard ) startGame ( ) } firstClick = true renderBoard ( gBoard ) }
Called when a cell (td) is clicked
Called when a cell ( td ) is clicked
// @CR: why call render board here if you are calling it at the end of the func? // @CR: no need to check game over, you did it at line 153 // @CR: why call render board here if you are calling it at the end of the func anyways? // @CR: no need for "===true", you can just if (gBoard[i][j].isMine === true) // @CR: this condition is a bit confusing, if firstClick === false then we are now doing the first click // @CR: thats why you should call it "isFirstClick", then if its true, it is pretty obvious we are in first click