📜  JavaScript | typedArray.@@species 与示例

📅  最后修改于: 2022-05-13 01:58:10.039000             🧑  作者: Mango

JavaScript | typedArray.@@species 与示例

typedArray.@@species是 JavaScript 中的一个内置属性,用于返回给定 typedArray 的构造函数。
typedArray 有多种类型,例如-

  • 整数8数组
  • Uint8Array
  • Uint8ClampedArray
  • Int16Array
  • Uint16Array
  • Int32Array
  • Uint32Array
  • Float32Array
  • 浮点64数组

句法:

typedArray[Symbol.species]

参数:它不接受任何参数,因为它是属性而不是函数。
返回值:它返回给定 typedArray 的构造函数。
显示此属性工作的 JavaScript 代码:


输出:

function Int8Array() { [native code] }
function Uint8Array() { [native code] }
function Uint8ClampedArray() { [native code] }
function Int16Array() { [native code] }
function Uint16Array() { [native code] }
function Int32Array() { [native code] }
function Uint32Array() { [native code] }
function Float32Array() { [native code] }
function Float64Array() { [native code] }