I was wondering how to declare new variables by accessing variable values in the same object. I tried this.x and object.x. Both say cannot read property of undefined.
e.g.
var board = {
width: 188,
height: 110,
left: (320 - board.width)/2,
top: (480 - this.height)/8,
};
You can’t do that because
boardis not defined until after the object is constructed and the assignment executes. (Also,thisis not defined outside a function.) You’ll have to use more than one statement.