Bugfix:binary-arrays/concat/solution
This commit is contained in:
parent
2cca9a9d09
commit
ae0a73fc1a
1 changed files with 2 additions and 2 deletions
|
@ -2,10 +2,10 @@ function concat(arrays) {
|
||||||
// sum of individual array lengths
|
// sum of individual array lengths
|
||||||
let totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
let totalLength = arrays.reduce((acc, value) => acc + value.length, 0);
|
||||||
|
|
||||||
if (!arrays.length) return null;
|
|
||||||
|
|
||||||
let result = new Uint8Array(totalLength);
|
let result = new Uint8Array(totalLength);
|
||||||
|
|
||||||
|
if (!arrays.length) return result;
|
||||||
|
|
||||||
// for each array - copy it over result
|
// for each array - copy it over result
|
||||||
// next array is copied right after the previous one
|
// next array is copied right after the previous one
|
||||||
let length = 0;
|
let length = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue