Skip to content

Commit 63ac731

Browse files
authored
Update collections-challenges.md
remove array spread in Set initialization i.e causing TypeError: not iterable (cannot read property Symbol(Symbol.iterator))
1 parent dc1e708 commit 63ac731

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

challenges/collections-challenges.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ If an object is passed the object reference is copied to all the slots and not t
291291
- Set is a data structure which does not allow duplicate elements
292292

293293
```js
294-
const set = new Set(...arr);
294+
const set = new Set(arr);
295295
const distinctArr = [...set];
296296
```
297297

@@ -343,8 +343,8 @@ const itAvgSalaryGT10K = itTotalSalaryGT10K / itEmployeesWithSalaryGT10K.length;
343343
- The union array will be the result if all the elements from the 2 arrays are picked
344344
345345
```js
346-
const set1 = new Set(...arr1);
347-
const set2 = new Set(...arr2);
346+
const set1 = new Set(arr1);
347+
const set2 = new Set(arr2);
348348
const distinctArr = [...set1, ...set2];
349349
```
350350

0 commit comments

Comments
 (0)