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

docs(ArrayBuffer): add conversion demos

This commit is contained in:
waiting 2017-10-14 11:58:24 +08:00
parent 0f0408563d
commit 2a82f81022
No known key found for this signature in database
GPG Key ID: 2C7023E12106AFFF

View File

@ -273,6 +273,10 @@ const typedArray = new Uint8Array([1, 2, 3, 4]);
TypedArray数组也可以转换回普通数组。 TypedArray数组也可以转换回普通数组。
```javascript ```javascript
const normalArray = [...typedArray];
// or
const normalArray = Array.from(typedArray);
// or
const normalArray = Array.prototype.slice.call(typedArray); const normalArray = Array.prototype.slice.call(typedArray);
``` ```