Tell us what’s happening:
So I am pretty sure that this is what it’s asking me to do. I used the spread operator to add the fragment array after the word “Learning”, and before , “is”, and “fun”
The spreadOut function returns Learning,to,code,is,fun.
but it keeps telling me that “spreadOut should return [“learning”, “to”, “code”, “is”, “fun”]”
I even tried changing the format to make it return exactly ‘[“learning”, “to”, “code”, “is”, “fun”]’
It’s not letting me pass. Does anyone know why?
Thank you for your time.
My code so far
function spreadOut() {
let fragment = ['to', 'code'];
let sentence = ["Learning", ...fragment, "is", "fun"]; // changing this line
return sentence;
}
// do not change code below this line
console.log(spreadOut());
My browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/combine-arrays-with-the-spread-operator