JavaScript Minesweeper Implementation