I am following an on-line tutorial to create a simple game in HTML using canvas and JavaScript. I tried to load what seemed to be perfectly fine code but nothing is showing up on the screen and I received an error in the console saying
Uncaught SyntaxError: Unexpected token =
This is the portion of my code that seems to be incorrect:
player = {
x: null,
y: null,
width: 20,
height: 100,
update = function() {},
draw = function() {
ctx.fillRect(this.x, this.y, this.width, this.height)
};
};
PS - this error is showing up in Chrome.