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:
parent
0f0408563d
commit
2a82f81022
@ -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);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user