Skip to content

Commit a95bdc7

Browse files
authored
Merge pull request #291 from longo-andrea/article/array-buffer
ArrayBuffer, binary arrays
2 parents 09ab77a + c5259d0 commit a95bdc7

File tree

4 files changed

+123
-123
lines changed

4 files changed

+123
-123
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
function concat(arrays) {
2-
// sum of individual array lengths
2+
// somma delle lunghezze dei singoli array
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+
// ogni array, lo copiamo in result
10+
// l'array successivo viene copiato subito dopo quello precedente
1111
let length = 0;
1212
for(let array of arrays) {
1313
result.set(array, length);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function concat(arrays) {
2-
// ...your code...
2+
// ...il vostro codice...
33
}
44

55
let chunks = [
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
# Concatenate typed arrays
2+
# Concatenate TypedArrays
33

4-
Given an array of `Uint8Array`, write a function `concat(arrays)` that returns a concatenation of them into a single array.
4+
Dato un array di `Uint8Array`, scrivete una funzione `concat(arrays)` che ritorna una loro concatenazione in un singolo array.

0 commit comments

Comments
 (0)