ES6 - Create Strings using Template Literals

Tell us what’s happening:
Describe your issue in detail here.
the course has become too hard for me do I need to complete it to become a software developer
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 = [...arr];
  // 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/116.0.0.0 Safari/537.36 Edg/116.0.1938.81

Challenge: ES6 - Create Strings using Template Literals

Link to the challenge:

Programming is hard. That’s totally normal. Working through hard problems is the job of programmers.

2 Likes

can you explain why i cannot spread the items in the object into the array

Use template literal syntax with backticks to create an array of list element (li) strings. Each list element’s text should be one of the array elements from the failure property on the result object and have a class attribute with the value text-warning. The makeList function should return the array of list item strings.

Use an iterator method (any kind of loop) to get the desired output (shown below).

[
  '<li class="text-warning">no-var</li>',
  '<li class="text-warning">var-on-top</li>',
  '<li class="text-warning">linebreak</li>'
]

You have three issues

  1. You are not using template literal syntax

  2. You are not using an iterator

  3. Your output doesn’t look like the requested output

1 Like