const arrayToSet = (arr) => new Set(arr); console.log(arrayToSet([1, 2, 2, 3])); // Set { 1, 2, 3 }
const setToArray = (set) => Array.from(set); console.log(setToArray(new Set([1, 2, 2, 3]))); // [1, 2, 3]