TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript TypedArray keys() Method

JavaScript TypedArray keys() Method with example, join() method, javascript typedarray methods, keys() method, indexOf() method, includes() method, forEach() method, entries(), every(), find(), filter(), copyWithin() method etc.

<< Back to JAVASCRIPT

JavaScript TypedArray keys() Method

The 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:

Chrome 38.0
Edge 8
Firefox 28.0
Opera 25.0

Example

JavaScript 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>
Test it Now

Output:

0
1





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf