数组有数据,但为什么长度为undefined?

小程序 文章 2020-08-06 15:21 1405 0 全屏看文

AI助手支持GPT4.0

数组有数据,但为什么长度为undefined?The array has data, but why is the length undefined?

数组有数据,但为什么长度为undefined?

如上图,buffer[1]中明明有数据,但是buffer.length却为undefiund,为什么?

我的数组实现方式是这样的


As shown in the figure above, there is data in buffer [1], but buffer.length It's undefiund. Why? This is how I implement arrays

回答:

o0o有脾气的酸奶:

ArrayBuffer没有length属性

var a = new ArrayBuffer(8)console.log(a.byteLength)  => 8

若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人

这名字不起了:

问题已解决,感谢一楼(已被删除)与三楼提供的答案。

?:

let a = {1:1,2:2};console.log(a[1]) // 这样子也等于1。

你确定你打印的是一个数组吗?

-EOF-

AI助手支持GPT4.0