ES6 - Create Strings using Template Literals

Tell us what’s happening:

Describe your issue in detail here.

Your code so far

const result = {
  success: ["max-length", "no-amd", "prefer-arrow-functions"],
  failure: ["no-var", "var-on-top", "linebreak"],
  skipped: ["no-extra-semi", "no-dup-keys"]
};
function makeList(arr) {
  // Only change code below this line
  const failureItems = [];
  // Only change code above this line

  return failureItems;
}

const failuresList = makeList(result.failure);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.731 YaBrowser/23.11.1.731 Yowser/2.5 Safari/537.36

Challenge Information:

ES6 - Create Strings using Template Literals

Reading the order of the task, I don’t even understand what needs to be written down and in what order, because everything here is very difficult for me to understand. It’s one thing to write this in back quotes, but besides this you need to do a bunch of other things that I don’t understand.

Hello @masha2!

Ok. Having made it this far you should feel proud and know that experienced programmers get stuck. The great thing about all of this is that it has to be logical or it just wouldn’t work.

Sometimes the best way forward is to pick apart a challenge - and just focus on one part of it, solve it, and move on to the next bit.

You say that everything is difficult to understand, but to help you understand, can you describe the first thing that you are having difficulty with?

Once we solve that, we can tackle the next thing. What do you say?

Does this help?
Keep up the good progress!

Happy Coding! :slightly_smiling_face:

From the instructions I see that you need to create an array of elements, I see it like this

`const li = `<li></li>`

Ok, that is close. Look at the section for entering your code. What is the one line already written for you?

An empty array was created.

Right. And what is returned by the function?

the function should return the elements wrapped by the class and the values from the failure object, each value separately

Yes, but more generally, what would you say the name of the array to be returned is?

variable when taking results into account

Called failureItems right?

Yes right failureItems

So, failureItems needs to be returned which is at the moment an empty array.

Now, looking at the desired output (on the left side of the screen), how would you describe each of the array elements?

for(let i =0;i<arr.length;i++){

}

Each element of the array is composed of something that looks like html, isn’t it? So, each element could be described as html of some sort.

This is an important fact to really understand, because this challenge is about using Template Literals. You will combine what you already know about html, arrays and objects, AND javascript.

Now, look at the coding window again. On line 1, how would you describe what is in the ‘result’ variable?

I only know how to output everything like this

console.log(`arrays${result}`)

console.log is a valuable tool.

You could use console.log(typeof(result)) to help you answer this question.

for me it’s already a little difficult

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.