Reputation: 45
I get an error on line this.show()
as " ';' expected. "
. I am very new to js so I think it's a simple mistake but I could not figure it out.
function Cell(i,j , height , width , color) {
this.cellColor = color ;
this.cellWidth = width ;
this.cellHeight = height;
this.x = j; // num from left
this.y = i; // num from top
this.connectedLimeCells = [];
this.connectedBlocks = [];
this.connectedOpenWhites = [];
this.neighbors = [] ;
this.show(){
fill(this.cellColor) ;
noStroke();
rect(this.x * this.cellWidth , this.y * this.cellHeight , this.cellWidth , this.cellHeight);
}
}
Upvotes: 2
Views: 183
Reputation: 20934
Right now you are calling your method.
this.show()
So the parser expects a ;
after you call this.show
.
What you meant to do was:
this.show = () => {}
Upvotes: 3