[英]Getting a wrong length when printing an array in console
在对数组进行console.log
时,我得到以下结果:
第一张图片(顶部)中的数字(25)代表什么? 我的数组的长度为 27,而不是 25。我认为这是非null
值的计数,但第二张图片表明并非如此。
(25) 和 (27) 也以简化形式存在:
这发生在 Firefox 和 Chrome 中。
导致这种行为的代码:
var lows = ts2values[current_ts];
var highs = ts2values[current_ts];
console.log("lows b : ", lows);
console.log("highs b : ", highs);
lows.push(null);
highs.push(null);
console.log("lows a : ", lows);
console.log("highs a : ", highs);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.