被搞亂了,發現這對某些東西來說很方便,但是如果你必須問我現在究竟是什麼,我將無法告訴你,所以想知道社區是否可以幫助識別元素和概念在以下...在這段JavaScript中發現了哪些元素/概念?
var MyStuff = {
STATS: {
SHOTS:0,
TRIES:0,
HIGHESTSCORE:0,
LIVESLOST:0
},
defaultLevel: 0,
players: [
{
name: 'Chuck',
surname: 'Norris',
punchline: 'Chuck Norris can set ants on fire with a magnifying glass, At night.',
dateCreated: '10/03/2011'
},
{
name: 'Mr',
surname: 'T',
punchline: 'I pity the fool who drinks soy milk.',
dateCreated: '10/03/2011'
}
],
startGame: function() {
alert("You shouldn't have come back, " + this.players[0].surname);
alert("" + this.players[1].punchline);
this.STATS.SHOTS = 0;
this.STATS.LIVESLOST = 1000000000000;
var smiles = this.STATS.LIVESLOST;
//TODO - More stuff
}
}
var KaPow = MyStuff;
用法:
KaPow.startGame();
alert("Starting Level: " + KaPow.defaultLevel);
alert("Player 1: " + KaPow.players[0].name + " " + KaPow.players[0].surname);
alert("Player 2: " + KaPow.players[1].name + " " + KaPow.players[1].surname);
alert("Score: " + KaPow.STATS.LIVESLOST);
那麼你想知道什麼?你想要這件作品嗎?或者你想了解這裏使用的java腳本的構造? – Kangkan 2011-03-10 14:15:29
- >「理解構造」;) – TigerMunky 2011-03-10 18:08:40