我有使用javascript一个奇怪的问题:放养新的Date()时的getTime()在一定的变量,它变为0javascript日期不能存储
console.log(new Date().getTime()); // Shows the timestamp
p.channels[p.chann].startTime = new Date().getTime();
console.log(p.channels[p.chann].startTime); // Shows 0
变量p.channels [p.chann] .startTime完全存在(否则会显示错误...)
有谁知道这个问题可能来自哪里? Oo
如果你把其他东西存储到变量中,比如'1'或''foo“',它会起作用吗? – JJJ
是'p'an对象,'p.channels'数组(或对象),'p.chan'是一个有效的索引(或键)和'p.channels [p.chann]'对象吗? – fcalderan
工程对我来说很好http://jsfiddle.net/s6NgS/ – Andreas