Skip to content
Related Articles

Related Articles

Improve Article

JavaScript | typedArray.@@species with Example

  • Last Updated : 03 Aug, 2018
Geek Week

The typedArray.@@species is an inbuilt property in JavaScript which is used to return the constructor of the given typedArray.
The typedArray is of many types like-

  • Int8Array
  • Uint8Array
  • Uint8ClampedArray
  • Int16Array
  • Uint16Array
  • Int32Array
  • Uint32Array
  • Float32Array
  • 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.
JavaScript code to show the working of this property:




<script>
  
    // 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
    document.write(a + "<br>");
    document.write(b + "<br>");
    document.write(c + "<br>");
    document.write(d + "<br>");
    document.write(e + "<br>");
    document.write(f + "<br>");
    document.write(g + "<br>");
    document.write(h + "<br>");
    document.write(i);
  
</script>

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

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :