Javascript对象获取值问题
光子Javascript SDK上有一个类ActorJavascript对象获取值问题,javascript,coffeescript,photon,Javascript,Coffeescript,Photon,光子Javascript SDK上有一个类Actor var Actor = (function() { function Actor(name, actorNr, isLocal) { //constructor this.name = name; this.actorNr = actorNr; this.isLocal = isLocal; this.customProperties = {}; this.suspended = false;
var Actor = (function() {
function Actor(name, actorNr, isLocal) { //constructor
this.name = name;
this.actorNr = actorNr;
this.isLocal = isLocal;
this.customProperties = {};
this.suspended = false;
}
...
}
它具有属性customProperties(对象)。当我尝试获取整个对象时,它会起作用:
console.log(actor.customProperties)
customProperties: {
255: ""
active_bonus: "0"
avatar: "https://pp.userapi.com/c840731/v840731367/24f5a/FMmqz25jPeg.jpg"
balance1: 8651830
balance2: 10
bonuses: {}
exp: 1792250
flag: ""
id: 4
rank: 0
register_date: "3/11/2016"
relations: (4)[-1, -1, -1, -1]
score: 0
state: "join"
stats: {
last_games: Array(5),
games: 253,
rank: 0,
register_date: "3/11/2016",
wins: 131
}
username: "player"
__proto__: Object
}
当我
尝试从该对象获取特定值,我在任何
案例
所有这些方法都返回未定义的。
关于这个问题,你有什么想法吗?我注意到表格中的行尾没有逗号
console.log(actor.customProperties)
输出。你确定customProperties是一个有效的JS对象而不是字符串吗?我只需要设置超时。参与者属性未初始化。问题解决了
console.log(actor.customProperties)