ES6 - Create Strings using Template Literals

Tell us what’s happening:
My code returns the correct answer, but it is not passing the test: * failuresList should be equal to the specified output.

I even printed out the const failuresList and it is identical to the returned value from the function.

Could use some help.

Thanks!

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 = [];
  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)

Here’s the printout from the console:

[ '<li class="text-warning">no-var<li>',
 '<li class="text-warning">var-on-top<li>',
 '<li class="text-warning">linebreak<li>' ]
failuresList should be equal to the specified output.

Blockquote

Your browser information:

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

Challenge: ES6 - Create Strings using Template Literals

Link to the challenge:

Take a look at the expected result versus what you have produced:

Expected: '<li class="text-warning">no-var</li>'
Given:    '<li class="text-warning">no-var<li>'

Do you see what is missing?

Simple…sometimes just takes a second pair of eyes. Thanks!

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