C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript TypedArray keys() MethodThe JavaScript keys() method is an inbuilt function in JavaScript. This method returns an Array Iterator object with the keys of an array. What is Iterator?An iterator is an object that keeps track of its current position, while accessing items in a collection one at a time. An iterator returns an object with two properties: key and value. Syntax:array.keys() Parameters:No parameters. Return value:It returns a new array iterator object containing the keys for each index of the elements of the given array. Browser Support:
ExampleJavaScript TypedArray keys() Method <script type="text/javascript"> // JavaScript to illustrate keys() method // Creating some typedArrays var A = new Uint8Array([1, 2, 3, 4, 5]); var B = new Uint8Array([5, 10, 15, 20]); a = A.keys() document.write(a.next().value +"<br>"); b = B.keys() b.next(); document.write(b.next().value +"<br>"); // expected output: arr[Output:0 1] </script> Output: 0 1
Next TopicJavaScript TypedArray Object
|