I was wondering which of these below is the best pracise, if it matters at all?
Should i use the this statement like so:
var object = {
x: 20,
y: 10,
width: this.x,
height: this.y,
render: function () { //renders object on canvas
ctx.fillRect(this.x, this.y, this.width, this.height);
}
};
Or should i use the object name like so:
var object = {
x: 20,
y: 10,
width: object.x,
height: object.y,
render: function () { //renders object on canvas
ctx.fillRect(object.x, object.y, object.width, object.height);
}
};
Thanks a lot in advance!