JavaScript typedArray.@@iterator
The typedArray.@@iterator is an inbuilt property in JavaScript which is used to return the initial value of the given typedArray’s element.
Syntax:
arr[Symbol.iterator]()
Parameters: It does not accept any parameter because it is a property not a function.
Return value: It returns the array iterator function i.e, values() function by default.
JavaScript code to show the working of this property:
javascript
var A = new Uint8Array([ 5, 10, 15, 20, 25 ]);
var a = A[Symbol.iterator]();
console.log(a.next().value);
console.log(a.next().value);
console.log(a.next().value);
console.log(a.next().value);
console.log(a.next().value);
|
Output:
5
10
15
20
25
Last Updated :
15 Feb, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...