Pixel Art

Step 2: Make a single variable for all of the squares, and add an event listener to each square.
Hint: Use the getElementsByClassName method to get all of the squares:
let squares = document.getElementsByClassName(`square`)
Then use a for...of loop to add an event listener to each square:
for (let square of squares) {
  square.addEventListener(`click`, toggleSquare)
}
Last step Next step