我正在學習一個教程,並在其中聲明瞭變量,然後繼續對他們做一些我不明白的事情。關於變量的簡單的Javascript事情
var player, ai, ball;
player = { // this is the code I am referring to
x: null,
y: null,
width: 20,
height: 100,
update: function(){},
draw: function(){
ctx.fillRect(this.x, this.y, this.width, this.height);
}
};
他在變量內添加變量嗎? 謝謝。
它是一個對象。 – epascarello
閱讀關於JavaScript數據結構的基本教程。 – 2015-12-15 04:08:53