TypedArray.prototype.slice()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TypedArray 实例的 slice() 方法将类型化数组的一部分的副本返回到从 start 到 end(不包括 end)中选择的新类型化数组对象中,其中 start 和 end 表示该类型化数组中项目的索引。原始类型化数组不会被修改。该方法与 Array.prototype.slice() 的算法相同。
¥The slice() method of TypedArray instances returns a copy of a portion of a typed array into a new typed array object selected from start to end (end not included) where start and end represent the index of items in that typed array. The original typed array will not be modified. This method has the same algorithm as Array.prototype.slice().
Try it
语法
参数
返回值
描述
¥Description
详细信息请参见 Array.prototype.slice()。此方法不是通用的,只能在类型化数组实例上调用。
¥See Array.prototype.slice() for more details. This method is not generic and can only be called on typed array instances.
示例
返回现有类型化数组的一部分
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-%typedarray%.prototype.slice |
浏览器兼容性
BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.