ES6 - Create Strings using Template Literals

Tell us what’s happening:
My code output comes as required but is not as per the design given in the challenge.
In the challenge, it is given that the square brackets must be in separate lines but unfortunately, I cannot. Please help guys…
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 = [];
  "use strict";
  for (let i = 0; i < arr.length; i++) {
    failureItems.push(`<li> class="text-warning">${arr[i]}</li>`);
  }
  // Only change code above this line

  return failureItems;
}

const failuresList = makeList(result.failure);
console.log(failuresList)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36

Challenge: ES6 - Create Strings using Template Literals

Link to the challenge:

2023-10-16T20:00:00Z2023-10-16T20:00:00Z2025-10-16T20:00:00Z

Hi @Yuasuf,

You are so close to the solution! There is only one small problem and you might kick yourself when you see it. You have an extra > that shouldn’t be there. Just remove the > from the <li> portion of the element you’re creating.

The reason is that you already have the element created inside of the string and have given it a class attribute, but by having that > right after <li you signal to the HTML document that that is all for that li element, when it shouldn’t be.

1 Like

Hello. I believe I found out your problem.

<li> class="text-warning">no-var</li> 

The following is one of the lines of html being generated. Your li element is lacking the class necessary to complete the challenge. Make the class be on your li element and you’ll pass.

Happy learning. :slightly_smiling_face:

1 Like

Thanks a lot, bro
Bro I feel to kick myself

Nah don’t do that! haha It’s all a learning experience. :slight_smile: Happy coding and learning!

1 Like

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