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 JavaScript Generator next() Method JavaScript Generator.prototype.next() method is an inbuilt method in JavaScript that is used to return an object with two properties done and value. Syntax: gen.next( value ); Parameters: This function accepts a single parameter as mentioned above and described below: value: This parameter holds the 2 min read JavaScript Array map() Method The map() method is an ES5 feature that creates a new array by applying a function to each element of the original array. It skips empty elements and does not modify the original array.JavaScriptconst a = [1, 2, 3, 4]; // Use map to create a new array with elements doubled const b = a.map(x => x 4 min read JavaScript typedArray.@@iterator The typedArray.@@iterator is an inbuilt property in JavaScript which is used to return the initial value of the given typedArray's element. Syntax: arr[Symbol.iterator]() Parameters: It does not accept any parameter because it is a property not a function. Return value: It returns the array iterator 1 min read JavaScript Map forEach() Method JavaScript Map.forEach method is used to loop over the map with the given function and executes the given function over each key-value pair.Syntax:myMap.forEach(callback, value, key, thisArg)Parameters:This method accepts four parameters as mentioned above and described below:callback: This is the f 3 min read Implement polyfill for Array.prototype.map() method in JavaScript In this article, we will learn how to implement a polyfill for an Array.prototype.map() method in JavaScript. What is a polyfill? A polyfill is a piece of computer code written to implement a feature in a browser that does not yet support it. It could be because of the older version of the browser y 4 min read Like