Create Strings using Template Literals - Help

Create Strings using Template Literals - Help
0.0 0


Tell us what’s happening:
Not really sure how I’m getting this wrong. I tested the output and it was correct, and I’m using Template literals. The test that fails is the one that checks whether or not I’m using template literals. I’d appreciate any help. Thanks.

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 = [];
  resultDisplayArray.push(`<li class="text-warning">${arr[0]}</li>`, `<li class="text-warning">${arr[1]}</li>`, `<li class="text-warning">${arr[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 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0.

Link to the challenge:


OK, so you are explicitly pushed the three messages on. OK, that should work and I’m not sure why it’s failing, certainly not for failing “Template strings were used”.

But your approach definitely isn’t the best practice. What if someone wanted to change the number of messages? You might want to use a different method, and it rhymes with “map”.

I would map over the array arr and return each of those lis. The map function returns the new array so you can just assign it directly into resultDisplayArray. This can all be done in one line.

Please let us know if this is not a sufficient clue.


This worked. I think it was looking for a very specific template string. Thank you.


Thank you, really helpful.