TypedArray
.prototype
属性表示TypedArray
构造器的原型.
TypedArray.prototype 属性的属性特性: |
|
---|---|
writable | false |
enumerable | false |
configurable | false |
描述
TypedArray
实例继承自 TypedArray.prototype
. 你可以通过该原型对象为所有的类型化数组(typed array types)实例添加属性和方法.
关于继承的更多的信息请参见关于TypedArray 的描述.
属性
TypedArray.prototype.constructor
- 返回创建实例原型的构造函数.这是相应的typed array type的默认的构造函数.
TypedArray.prototype.buffer
只读- 返回被格式化数组引用的
ArrayBuffer
. 创建时已被固化,因此是只读的. TypedArray.prototype.byteLength
只读- 返回从
ArrayBuffer
读取的字节长度. 创建时已被固化,因此是只读的. TypedArray.prototype.byteOffset
只读- 返回从
ArrayBuffer
读取时的字节偏移量.创建时已被固化,因此是只读的. TypedArray.prototype.length
只读- 返回在类型化数组中的元素的数量.创建时已被固化,因此是只读的.
methods
TypedArray.prototype.copyWithin()
- 浅拷贝数组的部分元素到同一数组的不同位置,且不改变数组的大小,返回该数组. 参见
Array.prototype.copyWithin()
. TypedArray.prototype.entries()
- 返回一个
Array Iterator
对象,该对象包含数组中每一个索引的键值对.参见Array.prototype.entries()
. TypedArray.prototype.every()
- 测试数组的所有元素是否都通过了指定函数的测试. 参见
Array.prototype.every()
. TypedArray.prototype.fill()
- 将一个数组中指定区间的所有元素的值, 都替换成或者说填充成为某个固定的值. 参见
Array.prototype.fill()
. TypedArray.prototype.filter()
- 使用指定的函数测试所有元素,并创建一个包含所有通过测试的元素的新数组. 参见
Array.prototype.filter()
. TypedArray.prototype.find()
- 返回一个满足提供的函数的测试的元素,若是没有满足的元素则返回
undefined
. 参见Array.prototype.find()
. TypedArray.prototype.findIndex()
- 查找数组中某指定元素的索引, 如果找不到指定的元素, 则返回 -1. 参见
Array.prototype.findIndex()
. TypedArray.prototype.forEach()
- 对数组的每个元素执行一次提供的函数(回调函数). 参见
Array.prototype.forEach()
. TypedArray.prototype.includes()
- 确定一个类型化数组是否包括了某个元素,包含就返回true,不包含就返回false.参见
Array.prototype.includes()
. TypedArray.prototype.indexOf()
- 返回数组中第一个等于指定值得元素的索引,如果找不到则返回-1. 参见
Array.prototype.indexOf()
. TypedArray.prototype.join()
- 将数组中的所有元素连接成一个字符串. 参见
Array.prototype.join()
. TypedArray.prototype.keys()
- 返回一个新的包含数组索引的数组迭代器. 参见
Array.prototype.keys()
. TypedArray.prototype.lastIndexOf()
- 返回数组中最后一个等于指定值得元素的索引,如果找不到则返回-1.参见
Array.prototype.lastIndexOf()
. TypedArray.prototype.map()
- 创建一个由原数组中的每个元素调用一个指定方法后的返回值组成的新数组.参见
Array.prototype.map()
. TypedArray.prototype.move()
未实现- 以前的不标准版本的
TypedArray.prototype.copyWithin()
. TypedArray.prototype.reduce()
- 接收一个函数作为累加器(accumulator),数组中的每个值(从左到右)开始合并,最终为一个值. 参见
Array.prototype.reduce()
. TypedArray.prototype.reduceRight()
- 接受一个函数作为累加器(accumulator),让每个值(从右到左,亦即从尾到头)缩减为一个值.(与
reduce()
的执行方向相反). 参见Array.prototype.reduceRight()
. TypedArray.prototype.reverse()
- 颠倒数组中元素的位置。第一个元素会成为最后一个,最后一个会成为第一个. 参见
Array.prototype.reverse()
. TypedArray.prototype.set()
- 读取一个指定数组中的元素保存到格式化数组中.
TypedArray.prototype.slice()
- 浅复制(shallow copy)数组的一部分到一个新的数组,并返回这个新数组. 参见
Array.prototype.slice()
. TypedArray.prototype.some()
- 数组中只要有一个元素满足提供的测试函数的测试就返回true,否则返回false. 参见
Array.prototype.some()
. TypedArray.prototype.sort()
- 对数组进行排序,并返回原数组(是改变原数组). 参见
Array.prototype.sort()
. TypedArray.prototype.subarray()
- 返回给定的起始和结束索引之间的元素组成的新的类型化数组.
TypedArray.prototype.values()
- 返回有数组中的元素组成的新的数组迭代对象. 参见
Array.prototype.values()
. TypedArray.prototype.toLocaleString()
- 返回一个将数组中的每个元素本地化后组成的字符串. 参见
Array.prototype.toLocaleString()
. TypedArray.prototype.toString()
- 返回一个由数组中的每个元素字符串化后组成的字符串. 参见
Array.prototype.toString()
. TypedArray.prototype[@@iterator]()
- 返回一个包含数组中每个元素的新的数组迭代对象.
规范
规范 | 状态 | 备注 |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) TypedArray prototype |
Standard | Initial definition. |
ECMAScript Latest Draft (ECMA-262) TypedArray prototype |
Draft |
浏览器兼容
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 7.0 | 4.0 (2) | 10 | 11.6 | 5.1 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.0 | (Yes) | 4.0 (2) | 10 | 11.6 | 4.2 |