function Square(parent, x, y) {
  if (parent) {
    this.x = parent.x;
    this.y = parent.y;
    this.neighbourCount = parent.neighbourCount;
    this.bombs = parent.bombs;
    this.owner = parent.owner;
  } else {
    this.x = x;
    this.y = y;
    this.neighbourCount =
        (x !== 0) + (x !== WIDTH - 1) + (y !== 0) + (y !== HEIGHT - 1);
    this.bombs = 0;
    this.owner = -1;
  }
}
// Otherwise, create a clone of the parent square.
Otherwise, create a clone of the parent square.
Otherwise create a clone of the parent square .
function Square(parent, x, y) {
  if (parent) {
    this.x = parent.x;
    this.y = parent.y;
    this.neighbourCount = parent.neighbourCount;
    this.bombs = parent.bombs;
    this.owner = parent.owner;
  } else {
    this.x = x;
    this.y = y;
    this.neighbourCount =
        (x !== 0) + (x !== WIDTH - 1) + (y !== 0) + (y !== HEIGHT - 1);
    this.bombs = 0;
    this.owner = -1;
  }
}
function Square ( parent , x , y ) { if ( parent ) { this . x = parent . x ; this . y = parent . y ; this . neighbourCount = parent . neighbourCount ; this . bombs = parent . bombs ; this . owner = parent . owner ; } else { this . x = x ; this . y = y ; this . neighbourCount = ( x !== 0 ) + ( x !== WIDTH - 1 ) + ( y !== 0 ) + ( y !== HEIGHT - 1 ) ; this . bombs = 0 ; this . owner = - 1 ; } }
Otherwise, create a clone of the parent square.
Otherwise create a clone of the parent square .