Open In App

JavaScript typedArray.@@species with Example

Improve
Improve
Like Article
Like
Save
Share
Report

The typedArray.@@species is an inbuilt property in JavaScript that is used to return the constructor of the given typedArray. 

The typedArray is of many types like:

Int8Array(); Int16Array(); Uint32Array();
Uint8Array(); Uint16Array(); Float32Array();
Uint8ClampedArray(); Int32Array(); Float64Array();

Syntax:

typedArray[Symbol.species]

Parameters: It does not accept any parameter because it is a property not a function.  

Return value: It returns the constructor of the given typedArray.

Example:

javascript




// Calling species property on different typedArray
a = Int8Array[Symbol.species];
b = Uint8Array[Symbol.species];
c = Uint8ClampedArray[Symbol.species];
d = Int16Array[Symbol.species];
e = Uint16Array[Symbol.species];
f = Int32Array[Symbol.species];
g = Uint32Array[Symbol.species];
h = Float32Array[Symbol.species];
i = Float64Array[Symbol.species];
  
// Printing the constructor of the given typedArray
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);
console.log(f);
console.log(g);
console.log(h);
console.log(i);


Output:

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] }

Last Updated : 15 Feb, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads