Problem with removing grid etch a sketch

Hi, I want to have the option to remove the grid from my etch a sketch, when a checkbox (styled as a switch) is checked, I created a function for it but I am getting the error " Uncaught TypeError: Cannot set property ‘border’ of undefined". I am confused on this and I have tried to set functions separately like other people were told on forums but it hasnt worked, does anyone have a solution?
js fiddle: ]https://jsfiddle.net/05xaruzm/4/
Thanks!

var bord = document.getElementsByClassName('square'); creates an array like object that holds all the squares that it finds. You can’t call the style property on it because it’s not a DOM element. You would need to iterate it like an array and set the style property on all of them.