Problem with "Create Strings using Template Literals"

Problem with "Create Strings using Template Literals"
0

#1

Tell us what’s happening:

Hi,

What’s wrong with my code please?

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>`];
  // 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 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals/


#2

hello!

Instead of result.failure, you should be using the input variable arr to access the strings
you will also need to create a for loop or use a map command instead of writing each string one by one

finally, when you have done the above properly, you will still have one error message left (the last test case will continue to fail) due to a known issue in the challenge that I believe has not been fixed yet. (but try and see how far you will go after making the above fixes).


#3

You’re code as-is will work, but for purposes of the lesson and passing the test, it won’t.

When a function is called, you generally use the argument to the function as a starting point instead of referencing objects outside of the function directly. That way, if a variable outside of the function definition is renamed, you don’t need to rewrite the function to use the variable’s name every time it changes.