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));
Run code snippetEdit code snippet Hide Results Copy to answer Expand

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
August 13, 2026 - This is to make maps valid set-like objects, because for maps, the iterator produces entries but the has() method takes keys. Arrays are not set-like because they don't have a has() method or the size property, and their keys() method produces indices instead of elements.
🌐
W3Schools
w3schools.com › js › js_sets.asp
JavaScript Sets
A JavaScript Set is a collection of unique values.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › from
Array.from() - JavaScript | MDN
The Array.from() static method creates a new, shallow-copied Array instance from an iterable or array-like object.
🌐
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 - 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).
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-array-to-set-in-javascript
How to Convert Array to Set in JavaScript? - GeeksforGeeks
July 12, 2025 - The Set constructor is used to convert the array into set in JavaScript. It is useful to clean the array and remove duplicate elements.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › TypedArray › set
TypedArray.prototype.set() - JavaScript | MDN
July 10, 2025 - The set() method of TypedArray instances stores multiple values in the typed array, reading input values from a specified array.
Find elsewhere
🌐
Koladechris
koladechris.com › blog › what-are-the-differences-between-array-and-set-in-javascript
What are the Differences between Array and Set in JavaScript?
December 1, 2024 - An Array has a ton of these methods, with many more being added after almost every JavaScript update release. They include push(), pop(), map(), filter(), and more. With set, you get access to methods like add(), delete(), has(), and clear(). In many situations, you might need to convert an array to a set and set to an array. For instance, if you want to remove a duplicate from an array, then you would need to convert it to a set:
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
You should use arrays when you want the element names to be numbers. JavaScript has a built-in array constructor new Array().
🌐
DEV Community
dev.to › keevcodes › the-javascript-set-object-2f75
The JavaScript Set Object - DEV Community
June 27, 2019 - Wait... what??? That's awesome! Yeah, my fellow developer, yeah. Instead of using the filter method, all we have to do is pass our postTypes array into the Set object and wrap it into an array.
🌐
Medium
medium.com › @conboys111 › what-happens-when-you-add-objects-or-arrays-to-a-javascript-set-b9f15dbbc5e0
What Happens When You Add Objects or Arrays to a JavaScript Set? | by myHotTake | Medium
November 11, 2024 - Here, since the same object (dragon1) is being added twice, the Set recognizes it and rejects the duplicate. It’s like someone trying to sneak the exact same dragon back into the shelter—nope, I already know that dragon! Arrays in JavaScript behave similarly to objects in Sets.
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-convert-array-to-set-in-javascript
How to convert Array to Set in JavaScript?
March 15, 2026 - Use new Set(array) as the standard method to convert arrays to Sets. This approach is the most efficient and readable way to eliminate duplicates from arrays in JavaScript.
🌐
WsCube Tech
wscubetech.com › resources › javascript › programs › array-to-set
Convert Array to Set in JavaScript (7 Programs With Output)
1 month ago - Learn how to convert an array to a Set in JavaScript with 7 practical examples. Understand each method with simple code and output to master Set conversion easily.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-set-to-array-in-javascript
Set to Array in JS or JavaScript - GeeksforGeeks
July 11, 2025 - A set can be converted to an array ... the form of an array. ... JavaScript Array.from() Method returns a new Array from an array, object or other iterable objects like Map, Set, etc....
🌐
freeCodeCamp
freecodecamp.org › news › set-and-map-in-javascript
How to Use Set and Map in JavaScript
February 10, 2023 - You initialize the set with an iterable by creating a set with some initial value. An iterable such as an array, set, or nodelist can be passed to the set. The example below shows a set created from an array of 4 elements.
🌐
Latenode
community.latenode.com › other questions › javascript
How can I turn a Set into an Array? - JavaScript - Latenode Official Community
October 11, 2024 - Array.from creates a shallow-copied Array from an array-like or iterable object, such as a Set.
🌐
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 - Array.from() method. The method creates a new instance of the array and converts the iterable into an array. ... Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L. ... The Spread operator can also be used to turn the set into an array.