I have a 5x5 grid and what I'm able to do so far is only change the color of a box one way from white to black, but I need it to alternate between black and white every time I click on the box.
Frankly I'm stumped and don't know how to make it alternate I tried to find other examples but I couldn't find any. Currently the following javascript code can only change the box color from white to black.
var grid = document.getElementsByClassName("box");
Array.from(grid).forEach(click => click.addEventListener("click", function() {v.style.background = "black";}));