JavaScript Map.prototype[@@iterator]() Method Last Updated : 09 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Map[@@iterator]( ) method is used to make Map iterable. Map[@@iterator]( ) method returns iterator object which iterates over all code points of Map. Map[@@iterator]( ) is built-in property of Map. We can use this method by creating Map iterator. We can make Map iterator by calling the @@iterator property. In place of @@iterator, we can use Symbol.iterator constant. Syntax: const iter = Map[ Symbol.iterator](); Parameters: This property does not accept any parameters. Return Value: It returns an iterator to iterating code point of iterator objects. Example: JavaScript <script> const m = new Map(); m.set(0, "a") m.set(2, "b") m.set(3, "c") const iterator = m[Symbol.iterator](); let itr = iterator.next() for (let i = 0; i < script m.size; i++) { console.log(itr.value, itr.done) itr = iterator.next() } </script> Output: [0 : 'a'] false [1 : 'b'] false [2 : 'c'] false Example: We can use Map.prototype[@@iterator] method with assign Map to the iterator. We can use for loop to iterate over the code point of Map. The for-of loop uses an iterator to iterate over values of Map. JavaScript <script> const m = new Map(); m.set(0, "a") m.set(2, "b") m.set(3, "c") const iterator = m[Symbol.iterator](); let itr = iterator.next() for (let i = 0; i < m.size; i++) { console.log(itr.value) itr = iterator.next() } console.log("iterating with for-of loop : ") for (let i of m) { console.log(i) } </script> Output: [0 : 'a'] [1 : 'b'] [2 : 'c'] iterating with for-of loop : [0 : 'a'] [1 : 'b'] [2 : 'c'] Supported Browsers: Chrome 38 and aboveEdge 12 and aboveFirefox 13 and aboveInternet Explorer 11 and aboveOpera 25 and aboveSafari 8 and above We have a complete list of Javascript Map methods, to check those please go through this JavaScript MapComplete Reference article. Comment More infoAdvertise with us Next Article JavaScript Map.prototype[@@iterator]() Method S satyam00so Follow Improve Article Tags : JavaScript Web Technologies javascript-map JavaScript-Methods Similar Reads Iterator Method | JavaScript Design Pattern Iterator design pattern is a behavioral design pattern that provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation. It separates the responsibility of accessing and traversing the elements from the aggregate object. This pattern is wi 4 min read Javascript String @@iterator Method String [@@iterator]( ) Method is used to make String iterable. [@@iterator]() returns an iterator object which iterates over all code points of String. String[@@iterator] is a Built-in Property of String. We can use this method by making a string iterator. We can make an iterator by calling the @@it 2 min read JavaScript Map get() Method The Map.get() method in JavaScript is a convenient way to retrieve the value associated with a specific key in a Map object. A Map in JavaScript allows you to store key-value pairs where keys can be of any data type, making it more useful compared to objects, which only allow strings and symbols as 3 min read JavaScript Map entries() Method JavaScript Map.entries() method is used for returning an iterator object which contains all the [key, value] pairs of each element of the map. It returns the [key, value] pairs of all the elements of a map in the order of their insertion. The Map.entries() method does not require any argument to be 4 min read JavaScript typedArray.map() Method The typedArray.map() is an inbuilt function in JavaScript which is used to create a new typedArray with the result of a provided function on each element of the given typedArray. Syntax: typedArray.map(callback) Parameters: It accepts a parameter callback function which accept some parameter which a 1 min read Like