• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • BigInt64Array

    BigInt64Array类型的数组代表由 64 位有符号整数组成的数组。如果需要控制字节顺序的话,请使用DataView代替。内容初始化为0n。一旦建立,就可以使用对象的方法或使用标准数组索引语法(即使用中括号表示法)引用数组中的元素。

    构造函数

    BigInt64Array()(en-US)

    创建一个新的BigInt64Array对象。

    静态属性

    BigInt64Array.BYTES_PER_ELEMENT

    返回一个元素大小的数字值。BigInt64Array返回8

    BigInt64Array.name

    返回构造函数名字的字符串值,如果是BigInt64Array类型的话,就是“BigInt64Array“。

    静态方法

    BigInt64Array.from()

    从类数组或者可迭代对象创建一个新的BigInt64Array,另请参见Array.from()

    BigInt64Array.of()

    从可变数量的参数创建一个新的BigInt64Array,另请参见Array.of()

    实例属性

    BigInt64Array.prototype.buffer

    返回被BigInt64Array引用的ArrayBuffer。这在BigInt64Array对象构建时期就被锁定了,所以是只读的。

    BigInt64Array.prototype.byteLength

    返回BigInt64ArrayArrayBuffer开始的长度(以字节为单位)。这在BigInt64Array对象构建时期就被锁定了,所以是只读的。

    BigInt64Array.prototype.byteOffset

    返回BigInt64ArrayArrayBuffer开始的偏移量(以字节为单位)。这在BigInt64Array对象构建时期就被锁定了,所以是只读的。

    BigInt64Array.prototype.length

    返回BigInt64Array中被保留的元素个数。这在BigInt64Array对象构建时期就被锁定了,所以是只读的。

    实例方法

    BigInt64Array.prototype.copyWithin()

    复制数组中的数组元素序列。另请参见Array.prototype.copyWithin()

    BigInt64Array.prototype.entries()

    返回一个新的迭代器(array iterator)对象,该对象包含数组中每个索引的键/值对。另请参见Array.prototype.entries()

    BigInt64Array.prototype.every()

    测试数组中的所有元素是否通过函数提供的测试。另请参见Array.prototype.every()

    BigInt64Array.prototype.fill()

    用静态值填充从起始索引到结束索引的数组的所有元素。另请参见Array.prototype.fill()

    BigInt64Array.prototype.filter()

    使用提供的筛选函数为其返回true的数组的所有元素创建一个新数组。另请参见Array.prototype.filter()

    BigInt64Array.prototype.find()

    如果数组中的元素满足提供的测试函数,则返回数组中找到的值;如果未找到,则返回undefined。另请参见Array.prototype.find()

    BigInt64Array.prototype.findIndex()

    如果数组中的元素满足提供的测试函数,则返回数组中找到的索引;如果未找到,则返回-1。另请参见Array.prototype.findIndex()

    BigInt64Array.prototype.forEach()

    为数组中的每个元素调用函数。另请参见Array.prototype.forEach()

    BigInt64Array.prototype.includes()

    确定类型化数组是否包含某个元素,并根据需要返回truefalse。另请参见Array.prototype.includes()

    BigInt64Array.prototype.indexOf()

    返回数组中元素的第一个(最小)索引,等于指定值;如果找不到,则返回-1。另请参见Array.prototype.indexOf()

    BigInt64Array.prototype.join()

    将数组的所有元素联接为字符串。另请参见Array.prototype.join()

    BigInt64Array.prototype.keys()

    返回一个新的array iterator,它包含数组中每个索引的键。另请参见Array.prototype.keys()

    BigInt64Array.prototype.lastIndexOf()

    返回数组中元素的最后一个(最大)索引,等于指定值;如果找不到,则返回-1。另请参见Array.prototype.lastIndexOf()

    BigInt64Array.prototype.map()

    创建一个新数组,其中包含对此数组中的每个元素调用所提供函数的结果。另请参见Array.prototype.map()

    BigInt64Array.prototype.reduce()

    对累加器和数组的每个值(从左到右)应用一个函数,以便将其减少为单个值。另请参见Array.prototype.reduce()

    BigInt64Array.prototype.reduceRight()

    对累加器和数组的每个值(从右到左)应用一个函数,以便将其减少为单个值。另请参见Array.prototype.reduceRight()

    BigInt64Array.prototype.reverse()

    反转数组元素的顺序——第一个变为最后一个,最后一个变为第一个。另请参见Array.prototype.reverse()

    BigInt64Array.prototype.set()

    TypedArray中存储多个值,从指定数组读取输入值。

    BigInt64Array.prototype.slice()

    提取数组的一部分并返回一个新数组。另请参见Array.prototype.slice()

    BigInt64Array.prototype.some()

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

    BigInt64Array.prototype.sort()

    对数组的元素进行就地排序并返回数组。另请参见Array.prototype.sort()

    BigInt64Array.prototype.subarray()

    从给定的起始和结束元素索引返回一个新的BigUint64Array

    BigInt64Array.prototype.values()

    返回一个新的array iterator对象,该对象包含数组中每个索引的值。另请参见Array.prototype.values()

    BigInt64Array.prototype.toLocaleString()

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

    BigInt64Array.prototype.toString()

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

    BigInt64Array.prototype[@@iterator]()

    返回一个新的array iterator对象,该对象包含数组中每个索引的值。

    例子

    不同的方法去创建一个BigInt64Array

    // From a length
    var bigint64 = new BigInt64Array(2);
    bigint64[0] = 42n;
    console.log(bigint64[0]); // 42n
    console.log(bigint64.length); // 2
    console.log(bigint64.BYTES_PER_ELEMENT); // 8
    
    // From an array
    var arr = new BigInt64Array([21n,31n]);
    console.log(arr[1]); // 31n
    
    // From another TypedArray
    var x = new BigInt64Array([21n, 31n]);
    var y = new BigInt64Array(x);
    console.log(y[0]); // 21n
    
    // From an ArrayBuffer
    var buffer = new ArrayBuffer(32);
    var z = new BigInt64Array(buffer, 0, 4);
    
    // From an iterable
    var iterable = function*(){ yield* [1n, 2n, 3n]; }();
    var bigint64 = new BigInt64Array(iterable);
    // BigInt64Array[1n, 2n, 3n]
    

    上篇:Float64Array

    下篇:BigUint64Array