正在乱搞,发现这对一些东西很方便,但如果你不得不问我现在到底是什么,我将无法告诉你,所以想知道社区是否可以帮助识别下列的...
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);