【发布时间】:2011-03-10 14:08:59
【问题描述】:
在搞砸了,发现这对一些东西很方便,但如果你不得不问我现在到底是什么,我无法告诉你,所以想知道社区是否可以帮助识别元素和以下概念...
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 脚本的构造?
-
-> "理解结构" ;)
标签: javascript elements identify