Update memory-game/components/MemoryGame.jsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/1500/head
prathoseraaj V 11 months ago committed by GitHub
parent 1ec5b53f9f
commit e8d31a93aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -25,11 +25,11 @@ const MemoryGame = () => {
const handleGridSize = (e) => { const handleGridSize = (e) => {
const size = parseInt(e.target.value); const size = parseInt(e.target.value);
if (2 <= size && size <= 10 && (size * size) % 2 === 0) { if (2 <= size && size <= 10 && (size % 2 === 0)) {
setGridSize(size); setGridSize(size);
setError(""); setError("");
} else { } else {
setError("Please enter a grid size where gridSize x gridSize is even (e.g. 2, 4, 6, 8, 10)"); setError("Please enter a grid size where gridSize is even (e.g. 2, 4, 6, 8, 10)");
} }
}; };

Loading…
Cancel
Save