Create Strings using Template Literalss

Tell us what’s happening:
hi, can someone show me what i am doing wrong?


Your code so far

const result = {
  success: ["max-length", "no-amd", "prefer-arrow-functions"],
  failure: ["no-var", "var-on-top", "linebreak"],
  skipped: ["id-blacklist", "no-dup-keys"]
function makeList(arr) {
  "use strict";

  // change code below this line
  const resultDisplayArray = [`<li class="text-warning"> ${result.failure[0]}</li>`,
                              `<li class="text-warning"> ${result.failure[1]}</li>`,
                              `<li class="text-warning"> ${result.failure[2]}</li>`];
   // const resultDisplayArray = `[result.failure[0],
            //                  result.failure[1],
            //                   result.failure[2]];`
  // change code above this line

  return resultDisplayArray;
 * makeList(result.failure) should return:
 * [ <li class="text-warning">no-var</li>,
 *   <li class="text-warning">var-on-top</li>, 
 *   <li class="text-warning">linebreak</li> ]
const resultDisplayArray = makeList(result.failure);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38.

Link to the challenge:

That solution probably would satisfy the test if you removed the space between the opening tag and the template literal. The challenge tests for exact match - kinda picky.

I think they were looking for a general case solution that looped through result.failure array building resultDisplayArray. That way if another failure case was added it would not break your code.

Hi !

I had the same problem with this challenge. I have to admit that the expected output written in comments is kind of misleading.

@alhazen1 is right though : you should use a higher order function that loops through the given array and renders a proper array of li tags.

thanks for the input