Template Literals problem

Template Literals problem
0

#1

Tell us what’s happening:

I am having trouble with this lesson. I am getting all the checkboxes except the third one, claiming that I am not using template strings. Can anyone tell me why I cannot trigger this third check with the template literals?

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">${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);
console.log(resultDisplayArray)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) 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

You need to use the map function. I suggest going through this:


#3

Thanks for the help, I changed my answer to include map, and it’s still not passing the check:

const resultDisplayArray = arr.map(x => <li class="text-warning">${x}</li>);

it’s giving me an error for ‘Invalid regular expression flags’

Sounds like it might just be a broken lesson.


#4

You are correct. The fix they put into place has a different bug in it which has not been resolved yet.