Just pass the array to the Set constructor. The Set constructor accepts an iterable parameter. The Array object implements the iterable protocol, so its a valid parameter.

var arr = [55, 44, 65];
var set = new Set(arr);
console.log(set.size === arr.length);
console.log(set.has(65));

See here

Answer from levi on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Set
Set - JavaScript - MDN Web Docs
js · const myArray = ["value1", "value2", "value3"]; // Use the regular Set constructor to transform an Array into a Set const mySet = new Set(myArray); mySet.has("value1"); // returns true // Use the spread syntax to transform a set into an Array. console.log([...mySet]); // Will show you ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › TypedArray › set
TypedArray.prototype.set() - JavaScript - MDN Web Docs
July 10, 2025 - js · set(array) set(array, targetOffset) set(typedarray) set(typedarray, targetOffset) array · The array from which to copy values.
🌐
Just Academy
justacademy.co › blog-detail › how-to-convert-set-to-array-in-javascript
How To Convert Set To Array In JavaScript
April 23, 2024 - 9) Understand that sets are ordered collections of unique elements, while arrays are ordered collections of elements with indices. 10) After converting a set to an array, you can perform array specific methods and operations on the array.
🌐
Medium
medium.com › @conboys111 › how-to-easily-convert-a-set-to-an-array-and-vice-versa-in-javascript-a4e28ac9ccef
How to Easily Convert a Set to an Array and Vice Versa in JavaScript | by myHotTake | Medium
November 4, 2024 - But what if I need to pack up my exhibit and return the artifacts to storage, while preserving the order and keeping everything (even duplicates) in my storage room? This is where the magic happens. I can easily convert my Set back into an Array, almost like unfolding the artifacts from the display case and putting them back into storage, but now the order might matter.
Find elsewhere
🌐
W3Schools
w3schools.com › js › js_sets.asp
JavaScript Sets
JSON Intro JSON Syntax JSON vs XML JSON Data Types JSON Parse JSON Stringify JSON Objects JSON Arrays JSON Server JSON PHP JSON HTML JSON JSONP JS jQuery · jQuery Selectors jQuery HTML jQuery CSS jQuery DOM JS Graphics · JS Graphics JS Canvas JS Plotly JS Chart.js JS Google Chart JS D3.js JS Examples · JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference ... A JavaScript Set is a collection of unique values.
🌐
Scaler
scaler.com › home › topics › how to convert set to array in javascript
How to Convert Set to Array in JavaScript - Scaler Topics
May 4, 2023 - Explanation: We only gave an iterable object as a parameter to the Array.from() method. The method creates a new instance of the array and converts the iterable into an array. ... The Spread operator can also be used to turn the set into an array.
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › set-to-array
Convert a Set to an Array in JavaScript - Mastering JS
July 10, 2025 - const set = new Set(['a', 'b', 'c']); Array.from(set); // ['a', 'b', 'c'] Array.from(set).map(c => c.toUpperCase()); // ['A', 'B', 'C']
🌐
W3docs
w3docs.com › javascript
How to Convert Set to Array in JavaScript
const set = new Set(['welcome', 'to', 'W3docs']); console.log(Array.from(set));
🌐
Medium
medium.com › front-end-weekly › es6-set-vs-array-what-and-when-efc055655e1a
ES6 — Set vs Array — What and when? | by Maya Shavin | Frontend Weekly | Medium
November 9, 2018 - Yup, by definition, Array and Set are technically different concepts. One of the biggest differences here, you may notice, is that elements in Array can be duplicate (unless you tell it not to be), and in Set, they just can’t (regardless what you decide).
🌐
Favtutor
favtutor.com › articles › set-to-array-javascript
Convert Set to Array in JavaScript (3 Easy Methods)
November 14, 2023 - To create a set from an array, simply make a set with desired elements. Use the spread operator (…) followed by the Set name inside square brackets to spread the elements into a new Array. Finally, store the array in a new variable.
🌐
Delft Stack
delftstack.com › home › howto › javascript › convert set to array
How to Convert Set to Array in JavaScript | Delft Stack
March 11, 2025 - One of the most elegant and straightforward ways to convert a Set to an Array in JavaScript is by using the spread operator (...). This operator allows you to take the elements of the Set and spread them into a new Array.
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
It is a common practice to declare arrays with the const keyword. Learn more about const with arrays in the chapter: JS Array Const.
🌐
Latenode
community.latenode.com › other questions › javascript
How can I turn a Set into an Array? - JavaScript
October 11, 2024 - A Set is an effective way to maintain Arrays with unique values, but accessing properties from a Set is limited, usually involving the somewhat cumbersome mySet.values().next(). It would be fine if methods like map coul…
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-convert-array-to-set
How to Convert an Array to a Set in JavaScript | bobbyhadz
May 10, 2025 - Use the Array.map() method to iterate over the array. On each iteration, access a specific property and return its value. Use the Set() constructor to convert the array to a Set object.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › set-vs-array-in-javascript
Set vs Array in JavaScript - GeeksforGeeks
August 5, 2025 - Sets are used to store collections of unique value without allowing duplication. The set is similar to the array and supports both insertion and deletion methods of the array.