A short-hand way to do it is to convert it to an array via the ES6 spread operator.

Then all the array functions are available to you.

const mySet = new Set([1,2,3,4]);
[...mySet].reduce(...);
Answer from ZephDavies on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Map › set
Map.prototype.set() - JavaScript - MDN Web Docs - Mozilla
September 7, 2026 - The set() method of Map instances adds a new entry with a specified key and value to this Map, or updates an existing entry if the key already exists.
🌐
W3Schools
w3schools.com › js › js_maps.asp
JavaScript Maps
You can add elements to a Map with the set() method: ... Map is an ES6 feature. ES6 is fully supported in all modern browsers since June 2017: ... Coding fundamentals as bite-sized lessons and challenges. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript ...
People also ask

How is a Set different from a Map in JavaScript?

A Set stores unique values, whereas a Map stores key-value pairs. Discover their differences in the Free JavaScript map set tutorial for beginners.

🌐
iqratechnology.com
iqratechnology.com › academy › javascript-training › js-map-set
Free JavaScript Map Set Tutorial for Beginners - JS Map & Set.
What is the purpose of a Map in JavaScript?

A Map object stores key-value pairs and allows keys of any data type, offering more flexibility than regular objects. Learn more in our JavaScript map set free course video.

🌐
iqratechnology.com
iqratechnology.com › academy › javascript-training › js-map-set
Free JavaScript Map Set Tutorial for Beginners - JS Map & Set.
Are Map and Set better than regular objects and arrays?
  • Use Map when you need key-value pairs with non-string keys.
  • Use Set for storing unique values without duplicates.
    Find helpful insights in the JavaScript map set free course video.
🌐
iqratechnology.com
iqratechnology.com › academy › javascript-training › js-map-set
Free JavaScript Map Set Tutorial for Beginners - JS Map & Set.
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Map and Set
Not necessarily an array. And the standard iteration for map returns same key/value pairs as map.entries(). So we get a plain object with same key/values as the map. A Set is a special type collection – “set of values” (without keys), where each value may occur only once.
🌐
Tania's Website
taniarascia.com › understanding-map-and-set-javascript
Understanding Map and Set in JavaScript | Tania Rascia's Website
February 12, 2020 - In this article, you learned that a Map is a collection of ordered key/value pairs, and that a Set is a collection of unique values. Both of these data structures add additional capabilities to JavaScript and simplify common tasks such as finding ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › set-vs-map-in-javascript
Set Vs Map in JavaScript - GeeksforGeeks
In JavaScript, Set and Map are built-in data structures used to store ordered collections of data, where Set holds unique values and Map stores data as key–value pairs.
Published: January 16, 2026
🌐
DEV Community
dev.to › rasaf_ibrahim › set-and-map-in-javascript-a-close-look-h01
Set and Map in JavaScript: A Close Look - DEV Community
November 8, 2023 - This is because Set is implemented with efficient data structures under the hood that allow for faster lookup. While Map and Object in JavaScript can appear to serve similar functions as collections of key-value pairs, there are significant differences that could affect which one we should use.
Find elsewhere
🌐
Educative
educative.io › blog › javascript-map-set
JavaScript map and set tutorial: How to use new built-in classes
Map and set simplify complex operations such as managing unique collections, filtering data, or working with key-value pairs, providing a more elegant and error-free approach than earlier JavaScript practices.
🌐
Iqra Technology
iqratechnology.com › academy › javascript-training › js-map-set
Free JavaScript Map Set Tutorial for Beginners - JS Map & Set.
April 24, 2025 - For Map: Use the has() method with a key. For Set: Use the has() method with a value. Example: ... Find this explained in the JavaScript map and set with free tutorial.
🌐
DigitalOcean
digitalocean.com › community › tutorials › understanding-map-and-set-objects-in-javascript
Understanding Map and Set Objects in JavaScript | DigitalOcean
Introduced in ECMAScript 2015, Maps in JavaScript are ordered collections of key/value pairs, and Sets are collections of unique values. In this article, you…
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-map-set-method
JavaScript Map set() Method - GeeksforGeeks
June 1, 2026 - let myMap = new Map(); // Adding key value pair with chaining myMap.set(1, "Rohan").set(2, "Sohan").set(3, "Trojan"); // Getting the values back console.log(myMap.get(1)); console.log(myMap.get(2)); console.log(myMap.get(3));
🌐
Javatpoint
javatpoint.com › javascript-map-set-method
JavaScript Map set() Method - javatpoint
JavaScript Map set() Method with example, javascript map methods, abs() method, round() method, ceil() method, floor() method, pow() method, random() method, sqrt() method, max() method, min() method, log() method, sin() method, cos() method, tan() method etc.
🌐
freeCodeCamp
freecodecamp.org › news › javascript-map-and-set-objects-explained
How to Use the JavaScript Map and Set Objects – Explained with Code Examples
February 21, 2024 - One example is when you send a network request using the fetch() method. You would create an object and convert it into a JSON string, so using a Map object won't give any benefit. The Set object allows you to store a collection of elements, just like an Array.
🌐
freeCodeCamp
freecodecamp.org › news › set-and-map-in-javascript
How to Use Set and Map in JavaScript
February 10, 2023 - They also have zero-based indexing for accessing elements. You can have duplicate elements in an array, and the element order is guaranteed. A set is a data structure used for storing data of any length and kind.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Map
Map - JavaScript - MDN Web Docs - Mozilla
August 13, 2026 - A Map object is iterated by key-value pairs — a for...of loop returns a 2-member array of [key, value] for each iteration. Iteration happens in insertion order, which corresponds to the order in which each key-value pair was first inserted into the map by the set() method (that is, there wasn't a key with the same value already in the map when set() was called).
🌐
Medium
mattburgess.medium.com › javascript-shinies-map-set-and-symbol-11bc4f0d2fbf
Javascript Shinies: Map, Set and Symbol | by Matt Burgess | Medium
April 9, 2025 - Well, the difference mostly comes up when the array or set is being used to check if we have a particular value already. When you do a check on an array using array.includes, JavaScript loops through the array to look for that value. On a large array that can be a lot.
🌐
Codecademy
codecademy.com › docs › javascript › map › .set()
JavaScript | Map | .set() | Codecademy
March 11, 2024 - Key-value pairs are stored in a Map object using the .set() method.
🌐
TechRepublic
techrepublic.com › home › devops
JavaScript Map and Set Tutorial
November 4, 2023 - The Map object in JavaScript provides several key methods for adding, retrieving and manipulating key-value pairs. The set() method is used to add or update a key-value pair in a Map. It takes two arguments: the key, which can be of any data ...
🌐
TutorialsPoint
tutorialspoint.com › javascript › javascript_map_set_method.htm
JavaScript - Map.set() Method
The Map.set() method in JavaScript is used to add or update a key-value pair in a Map object. It takes two parameters: the key and the value. If the key already exist in the map, the value associated with the key will be updated to the new value ...