非常教程

JavaScript参考手册

TypedArray

TypedArray.prototype

该属性表示构造函数的原型。TypedArray.prototypeTypedArray

| Property attributes of TypedArray.prototype |

|:----|

| Writable | no |

| Enumerable | no |

| Configurable | no |

描述

TypedArray实例继承自TypedArray.prototype。您可以使用构造函数的原型对象向所有TypedArray实例添加属性或方法,其中TypedArray是其中一种类型的数组类型。

有关继承的更多信息,另请参阅有关TypedArray的描述。

属性

TypedArray.prototype.constructor返回创建实例原型的函数。这是默认情况下相应的类型化数组类型函数。

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()用提供的过滤函数返回true的此数组的所有元素创建一个新数组。另见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 Iterator包含数组中每个索引的键的新键。另见Array.prototype.keys()TypedArray.prototype.lastIndexOf()返回数组中等于指定值的元素的最后(最大)索引,如果没有找到,则返回-1。另见Array.prototype.lastIndexOf()TypedArray.prototype.map()使用在此数组中的每个元素上调用提供的函数的结果创建一个新数组。另见Array.prototype.map()

TypedArray.prototype.move()UnimplementedFormer的非标准版本TypedArray.prototype.copyWithin()

TypedArray.prototype.reduce()针对累加器和阵列的每个值(从左到右)应用函数,以将其减少为单个值。另见Array.prototype.reduce()

TypedArray.prototype.reduceRight()针对累加器和阵列的每个值(从右到左)应用函数,以将其减少为单个值。另见Array.prototype.reduceRight()

TypedArray.prototype.reverse()颠倒数组元素的顺序 - 第一个变为最后一个,最后一个变为第一个。另见Array.prototype.reverse()

TypedArray.prototype.set()在类型数组中存储多个值,从指定数组中读取输入值。TypedArray.prototype.slice()提取数组的一部分并返回一个新数组。另见Array.prototype.slice()

TypedArray.prototype.some()如果此数组中至少有一个元素满足提供的测试函数,则返回true。另见Array.prototype.some()

TypedArray.prototype.sort()对数组中的元素进行排序并返回数组。另见Array.prototype.sort()

TypedArray.prototype.subarray()从给定的开始和结束元素索引中返回一个新的TypedArray。TypedArray.prototype.values()返回Array Iterator包含数组中每个索引值的新对象。另见Array.prototype.values()

TypedArray.prototype.toLocaleString()返回表示数组及其元素的本地化字符串。另见Array.prototype.toLocaleString()

TypedArray.prototype.toString()返回表示数组及其元素的字符串。另见Array.prototype.toString()

TypedArray.prototype[@@iterator]()返回一个新的Array Iterator 包含数组中每个索引值的对象。

产品规格

Specification

Status

Comment

ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'TypedArray prototype' in that specification.

Standard

Initial definition.

ECMAScript Latest Draft (ECMA-262)The definition of 'TypedArray prototype' in that specification.

Draft

浏览器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

7.0

(Yes)

4.0 (2)

10

11.6

5.1

Feature

Android

Edge

Chrome for Android

Firefox Mobile (Gecko)

IE Mobile

Opera Mobile

Safari Mobile

Basic support

4.0

(Yes)

(Yes)

4.0 (2)

10

11.6

4.2

JavaScript

JavaScript 是一种高级编程语言,通过解释执行,是一门动态类型,面向对象(基于原型)的解释型语言。它已经由ECMA(欧洲电脑制造商协会)通过 ECMAScript 实现语言的标准化。它被世界上的绝大多数网站所使用,也被世界主流浏览器( Chrome、IE、FireFox、Safari、Opera )支持。JavaScript 是一门基于原型、函数先行的语言,是一门多范式的语言,它支持面向对象编程,命令式编程,以及函数式编程。它提供语法来操控文本、数组、日期以及正则表达式等,不支持 I/O,比如网络