Create Strings using Template Literals pls help with code

Create Strings using Template Literals pls help with code
0

#1

Tell us what’s happening:

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 = `${result.failure[0]}`;
  // 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_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

it’s a known issue. They are still waiting to push the fix into production.


#3

so is it a production problem?


#4

Your code is not correct at the moment. Even if it were correct, the final test listed will fail because of a known issue (that may or may not have been fixed yet, only way to know is to fix your code and try).

So to fix your code, please consider:

1- you are given a parameter ‘arr’ , use it instead of using the result object
2- you are asked to create <li> strings. Try to do that. So far you have not.
3- you need to have 3 different <li> created. So you will need to write some kind of loop.

hope this helps


#5

Hi,
The bug in the testing code appears to have been fixed. Woohoo!

You are passing this array of strings to your function

["no-var", "var-on-top", "linebreak"]

…and from that you are to create this new array of strings using template literal syntax

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

…then you return this new array.


#6

how could you tell it has been fixed? (were you able to get past the challenge?)

Edit: nevermind, I see now that I am able to pass the challenge so that’s probably how you figured that out.


#7

i’m not able to crack this problem pls help me out!


#8

The template literal syntax, or the ${ variable }, can only pass the function or object specified. Remember, you’re writing a general function, one that if you wanted to pass the values for success or ** skipped** you could. Everything @hbar1st said is correct. Make the changes she said and your code will be correct.


#9

hi, just click on the ‘ask for help’ button in the challenge so that you create your own post of your code and you could tell us which part you need help with. We can’t help without seeing the code you tried.