1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 10:22:23 +00:00

fix: ab2string() calculation of array length

This commit is contained in:
waiting 2017-10-14 16:26:26 +08:00
parent 143a1e4b13
commit 4640bed36a
No known key found for this signature in database
GPG Key ID: 2C7023E12106AFFF

View File

@ -456,9 +456,9 @@ function ab2str(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
const len = bufView.byteLength;
const bstr = new Array(len);
const bufView = new Uint16Array(buf);
const len = bufView.length;
const bstr = new Array(len);
for (let i = 0; i < len; i++) {
bstr[i] = String.fromCharCode.call(null, bufView[i]);
}