Skip to content

Commit 34f4904

Browse files
bemselfleviding
authored andcommitted
ArrayBuffer, binary arrays (#529)
* init trans of array buffer * update trans for array buffer article * arraybuffer: minor update * arraybuffer: update task md * arraybuffer: add trans for solution js * arraybuffer: update trans against review comments * arraybuffer: update against review comments * arraybuffer: resolve review comment resolve review comment Co-Authored-By: LeviDing <[email protected]> * arraybuffer: resolve review comment Co-Authored-By: LeviDing <[email protected]> * arraybuffer: resolve review comment Co-Authored-By: LeviDing <[email protected]> * arraybuffer: resolve review comment Co-Authored-By: LeviDing <[email protected]> * arraybuffer: resolve review comment Co-Authored-By: LeviDing <[email protected]> * arraybuffer: update against review comments * arraybuffer: update against review comment
1 parent eebe9ae commit 34f4904

File tree

4 files changed

+121
-121
lines changed

4 files changed

+121
-121
lines changed

Diff for: 4-binary/01-arraybuffer-binary-arrays/01-concat/_js.view/solution.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
function concat(arrays) {
2-
// sum of individual array lengths
2+
// 对每个数组长度求和
33
let totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
44

55
if (!arrays.length) return null;
66

77
let result = new Uint8Array(totalLength);
88

9-
// for each array - copy it over result
10-
// next array is copied right after the previous one
9+
// 对于每个数组 — 复制到 result
10+
// 下一个数组在前一个后面复制
1111
let length = 0;
1212
for(let array of arrays) {
1313
result.set(array, length);

Diff for: 4-binary/01-arraybuffer-binary-arrays/01-concat/_js.view/source.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function concat(arrays) {
2-
// ...your code...
2+
// ……你的代码……
33
}
44

55
let chunks = [
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
# Concatenate typed arrays
2+
# 拼接类型化数组(Concatenate typed arrays
33

4-
Given an array of `Uint8Array`, write a function `concat(arrays)` that returns a concatenation of them into a single array.
4+
给定一个 `Uint8Array` 数组,请写一个函数 `concat(arrays)`,将数组拼接成一个单一数组并返回。

0 commit comments

Comments
 (0)