[英]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.