JavaScript TypedArray values() Method - JavaScript Tutorial

JavaScript TypedArray values() Method

BLUF: This tutorial on JavaScript TypedArray values() Method provides an in-depth look at JavaScript's core features. It includes practical examples and code snippets to help you master modern JS development.
Key Discovery: JavaScript TypedArray values() Method

Understanding JavaScript TypedArray values() Method is crucial for building dynamic, interactive web applications. Explore the examples below to see it in action.

The values method in JavaScript serves the purpose of establishing the value of the elements contained within an array.

Syntax:

Example

array.values()

Parameters:

No parameters

Return value:

Index value

Browser Support:

Chrome Yes
Safari Yes
Firefox Yes
Opera Yes

Example 1

JavaScript TypedArray values Method.

Example

<script>

//JavaScript to illustrate types() method

 var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);

  // Calling array.values() method

   var pyVisualizer = A.values();

   // Printing value of index 0

   document.write(pyVisualizer.next().value);

    // expected output:1

</script>

Output:

Example 2

JavaScript TypedArray values Method.

Example

<script>

 //JavaScript to illustrate types() method 

var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);

   // Calling array.values() method

   var pyVisualizer = A.values();

// shift index to the 1 

iterator.next();

   // Printing the value of index 1

   document.write(pyVisualizer.next().value);

    // expected output:3

</script>

Output:

Example 3

JavaScript TypedArray values Method.

Example

<script>

 //JavaScript to illustrate types() method

 var A = new Uint8Array([ 1,3,4,5,6,7,8,9 ]);

   // Calling array.values() method

   var pyVisualizer = A.values();

       iterator.next()

       iterator.next()

       iterator.next()

       iterator.next()

       iterator.next()

       iterator.next()

       iterator.next()

       iterator.next()

   document.write(pyVisualizer.next().value);

    // expected output:undefined

</script>

Output:

Output

Undefined

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience