Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zh-cn]: update the translation of ArrayBuffer.byteLength #17053

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@ slug: Web/JavaScript/Reference/Global_Objects/ArrayBuffer/byteLength

{{JSRef}}

`byteLength` 访问器属性表示一个 {{jsxref("ArrayBuffer")}} 对象的字节长度
{{jsxref("ArrayBuffer")}} 实例的 `byteLength` 访问器属性返回该数组缓冲区的长度(以字节为单位)

{{EmbedInteractiveExample("pages/js/arraybuffer-bytelength.html")}}

## 语法

```plain
arraybuffer.byteLength
```

## 描述

byteLength 属性是一个访问器属性,它的 set 访问器函数是 undefined,这意味着你只能读这个属性。该值在数组创建时确定,并且不可变更。如果这个`ArrayBuffer` 被移除,则此属性返回 0。
`byteLength` 属性是一个访问器属性,它的 set 访问器函数是 `undefined`,这意味着你只能读取这个属性。该值在数组创建时确定,并且无法修改。如果这个 `ArrayBuffer` 被分离,则此属性返回 0。

## 示例

### 使用 byteLength

```js
var buffer = new ArrayBuffer(8);
const buffer = new ArrayBuffer(8);
buffer.byteLength; // 8
```

Expand All @@ -34,6 +30,6 @@ buffer.byteLength; // 8

{{Compat}}

## 相关链接
## 参见

- {{jsxref("ArrayBuffer")}}