Tell us what’s happening:
I put everything I can think of with the instruction and can’t figure this out
**Your code so far**
function checkSet(set){
// Only change code below this line
const checkSet = new Set([1,2,3,4,5,6,7])
var setToArr = [...1,2,3,4,5,6,7]
console.log(1,2,3,4,5,6,7)
// Only change code above this line
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15
Challenge: Use Spread and Notes for ES5 Set() Integration
Thank you, I just redid the code and I only have to return its containing value like this: “return ([1,2,3,4,5,6,7])” and challenge was complete. I struggled this in the morning and wasn’t sure I could beat this but thank you for the help. Much appreciated.
While this does pass the challenge, unfortunately it missing the learning component of the challenge.
Right now you are returning a hardcoded array of seven numbers to pass the challenge.
But what if I wanted to test this function using this function call
checkSet(new Set([17,2,8]))
Right now your code would return [ 1, 2, 3, 4, 5, 6, 7 ] which wouldn’t make sense in this context.
That is why you want to use the spread operator with the function parameter of set.
function checkSet(set){
// Only change code below this line
return [...set]
// Only change code above this line
}
Now our code will produce the correct results for the checkSet(new Set([17,2,8])) function call.
Remember that you want to write functions that use the function parameters and can be reusable for hundreds or even thousands of function calls.