mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
fix: ab2string() calculation of array length
This commit is contained in:
parent
143a1e4b13
commit
4640bed36a
@ -456,9 +456,9 @@ function ab2str(buf) {
|
|||||||
return String.fromCharCode.apply(null, new Uint16Array(buf));
|
return String.fromCharCode.apply(null, new Uint16Array(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
const len = bufView.byteLength;
|
|
||||||
const bstr = new Array(len);
|
|
||||||
const bufView = new Uint16Array(buf);
|
const bufView = new Uint16Array(buf);
|
||||||
|
const len = bufView.length;
|
||||||
|
const bstr = new Array(len);
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
bstr[i] = String.fromCharCode.call(null, bufView[i]);
|
bstr[i] = String.fromCharCode.call(null, bufView[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user