Tell us what’s happening:
I don’t know what’s wrong.
Your code so far
function spreadOut() {
let fragment = ['to', 'code'];
let sentence = ['learning', 'to', 'code', 'is', 'fun']; // change this line
return sentence;
}
// do not change code below this line
console.log(spreadOut());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.
I should write that code:
function spreadOut() {
let fragment = [‘to’, ‘code’];
let sentence; // change this line
return sentence = [‘learning’, ‘to’, ‘code’, ‘is’, ‘fun’];
}
// do not change code below this line
console.log(spreadOut());
Yes…when write that code:
function spreadOut() {
let fragment = [‘to’, ‘code’];
let sentence; // change this line
return sentence = [“learning”, “to”, “code”, “is”, “fun”];
}
// do not change code below this line
console.log(spreadOut());
It tell me that spreadOut should return ["learning", "to", "code", "is", "fun"] is right.But you tell me it isn’t right.
I don’t want the answers but I am tell you that I don’t understand and we are in forum iof free code camp and you should to help me if I don’t understand but thank you for helping I will see again my exercise and I tell you.
Hi, @Klaudia. The whole idea of this challenge is not just only to pass it, but also to make you understand new concepts and give you more knowledge. @camperextraordinaire is doing a great job by pushing you to learn and look through the instructions attentively. Take a look at the example given in the instructions. Can you see the spread operator ... on line 2 and how it is used to place already declared array into another and merge them together? Do you understand what is happening? If so, there should be no problem for you to complete this exercise, because it’s basically the same stuff.
Try to absorb new concepts and use them. They were created to help and let you write your code faster and cleaner. Hope this helps Happy coding!
@Klaudia
You need to use spread operator(…) which you learned in earlier ES6 , Below code will work and pass your test cases let sentence = ['learning', ...fragment, 'is', 'fun'];