You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the introduction for this exercise was missing crucial information that prevented a learner from completing the task without doing external research. I've added additional information that should be sufficient to allow the learner to complete the task without any additional Googling.
Copy file name to clipboardExpand all lines: exercises/concept/ozans-playlist/.docs/introduction.md
+26
Original file line number
Diff line number
Diff line change
@@ -25,5 +25,31 @@ console.log(set.size);
25
25
//=> 4
26
26
```
27
27
28
+
You can provide an array as an argument when creating a set, and the array's values will become the values of the set, also removing the duplicate values.
29
+
30
+
```javascript
31
+
constarray= [1, 5, 4, 1];
32
+
constset=newSet(array); // the set's values become [1, 5, 4]
33
+
34
+
console.log(set.size);
35
+
//=> 3
36
+
```
37
+
38
+
To convert a set to an array, you can use [Array.from()][mdn-array-from], which converts an iterable such as a set or a map to an array.
0 commit comments