function showCell(elCell, i, j) {
    // CR: You can do it in one line:
    // CR: elCurrCell = document.querySelector(`.${getClassName(elCell)}`);
    var tempElCell = getClassName(elCell);
    var elCurrCell = document.querySelector(`.${tempElCell}`);

    // CR: Try to change the style with css classes and not inline style.
    if (elCell.isMine) { //red background for the mine
        elCurrCell.style = "background-color: red"
        // CR: I would put it in the gameOver func.
        changeEmogi(EMOGI_DEAD);

    } else {
        elCurrCell.style = "background-color: rgb(150, 149, 149)"
        elCell.isShown = true;
        gState.shownCount++;
    }

    if (elCell.minesAroundCount !== 0) {
        elCurrCell.innerText = `${elCell.minesAroundCount}`;
    }

    elCell.isShown = true;
    if (elCell.minesAroundCount === 0 && !elCell.isMine) expandShown(gBoard, elCell, i, j);
    // CR: You already checked it in the first if statement.
    // CR: You should do the gameOver() up there.
    if (elCell.isMine) gameOver();

}
// CR: You have the i and j inside the elCell.
You have the i and j inside the elCell.
You have the i and j inside the elCell .
function showCell(elCell, i, j) {
    var tempElCell = getClassName(elCell);
    var elCurrCell = document.querySelector(`.${tempElCell}`);
    if (elCell.isMine) { 
        elCurrCell.style = "background-color: red"
        changeEmogi(EMOGI_DEAD);
    } else {
        elCurrCell.style = "background-color: rgb(150, 149, 149)"
        elCell.isShown = true;
        gState.shownCount++;
    }
    if (elCell.minesAroundCount !== 0) {
        elCurrCell.innerText = `${elCell.minesAroundCount}`;
    }
    elCell.isShown = true;
    if (elCell.minesAroundCount === 0 && !elCell.isMine) expandShown(gBoard, elCell, i, j);
    if (elCell.isMine) gameOver();
}
function showCell ( elCell , i , j ) { var tempElCell = getClassName ( elCell ) ; var elCurrCell = document . querySelector ( ` ${ tempElCell } ` ) ; if ( elCell . isMine ) { elCurrCell . style = "background-color: red" changeEmogi ( EMOGI_DEAD ) ; } else { elCurrCell . style = "background-color: rgb(150, 149, 149)" elCell . isShown = true ; gState . shownCount ++ ; } if ( elCell . minesAroundCount !== 0 ) { elCurrCell . innerText = ` ${ elCell . minesAroundCount } ` ; } elCell . isShown = true ; if ( elCell . minesAroundCount === 0 && ! elCell . isMine ) expandShown ( gBoard , elCell , i , j ) ; if ( elCell . isMine ) gameOver ( ) ; }
CR: You have the i and j inside the elCell.
CR : You have the i and j inside the elCell .
// CR: You can do it in one line: // CR: elCurrCell = document.querySelector(`.${getClassName(elCell)}`); // CR: Try to change the style with css classes and not inline style. //red background for the mine // CR: I would put it in the gameOver func. // CR: You already checked it in the first if statement. // CR: You should do the gameOver() up there.