2018-09-30 23:01:58 +01:00
---
id: 587d8255367417b2b2512c73
title: Use Spread and Notes for ES5 Set() Integration
challengeType: 1
---
## Description
< section id = 'description' >
Do you remember the ES6 spread operator < code > ...< / code > ?
< code > ...< / code > can take iterable objects in ES6 and turn them into arrays.
Let's create a Set, and check out the spread function.
< blockquote > var set = new Set([1,2,3]);< br > var setToArr = [...set]< br > console.log(setToArr) // returns [ 1, 2, 3 ]< / blockquote >
< / section >
## Instructions
< section id = 'instructions' >
In this exercise we will pass a set object to the < code > checkSet< / code > function. It should return an array containing the values of the Set.
Now you've successfully learned how to use the ES6 < code > Set()< / code > object, good job!
< / section >
## Tests
< section id = 'tests' >
```yml
- text: Your Set was returned correctly!
2018-10-02 15:02:53 +01:00
testString: 'assert(function(){var test = checkSet(new Set([1,2,3,4,5,6,7])); test === [ 1, 2, 3, 4, 5, 6, 7 ]}, ''Your Set was returned correctly!'');'
2018-09-30 23:01:58 +01:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function checkSet(set){
// change code below this line
// change code above this line
}
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
function checkSet(set){
return [...set];}
```
< / section >