Hi, here is I got stuck a little. I don’t get why I can’t get access to a ‘cell’. I’ve tried it with ‘this’ and ‘grid.cell’ and it throws me an error ‘Uncaught TypeError: Cannot read property ‘value’ of undefined’, why the cell is undefined (of gridField array)?
let grid = {
step: 16,
width: 5,
height: 10,
cell: {
x: 0 },
gridField: [this.cell, this.cell,this.cell, this.cell],
drawCell: function(){
ctx.clearRect(20, y, 20, 20);
ctx.fillStyle = 'black';
ctx.fillRect(20, y, 20, 20,);
},
drawGrid: function(){
this.gridField.forEach(cell =>{
if (cell.value === 0){
this.drawCell();
}
})
}
}