JavaScript typedArray.values() with Examples
The Javascript typedArray.values() is an inbuilt function in JavaScript that is used to get the specified value of the contents of the typedArray().
Syntax:
typedArray.values()
Parameters It does not accept any parameters.
Return value: It returns the specified value of the given typedArray object.
JavaScript examples to show the working of this function:
Example 1: In this example, we will see the basic use of the typedArray.values() function.
javascript
<script>
const A = new Uint8Array([ 5, 10, 15, 20, 25, 30 ]);
const B = A.values();
B.next();
B.next();
B.next();
console.log(B.next().value);
</script>
|
Output:
20
Example 2: Here output is undefined because the array iterator crosses the upper bound.
javascript
<script>
const A = new Uint8Array([5, 10, 15, 20, 25, 30]);
const B = A.values();
B.next();
B.next();
B.next();
B.next();
B.next();
B.next();
console.log(B.next().value);
</script>
|
Output:
undefined
Last Updated :
22 Dec, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...