Perplexing for beginners: error in question required output against code

Tell us what’s happening:
The required output contains quotes but in solving the code, you do not have to include in order to be correct. It makes it perplexing for beginners

  **Your code so far**

const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["no-extra-semi", "no-dup-keys"]
function makeList(arr) {
// Only change code below this line
const failureItems=[];
for(let i=0; i<arr.length; i++){

failureItems.push(`<li class="text-warning">${arr[i]}</li>`);
// Only change code above this line

return failureItems;

const failuresList = makeList(result.failure);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0

Challenge: Create Strings using Template Literals

Link to the challenge:

I’m not sure I understand your confusion. Can you give a specific example?

this code didn’t work

for(let i=0; i<arr.length; i++){

failureItems.push(`'<li class="text-warning">${arr[i]}</li>'`);

But this code worked.

for(let i=0; i<arr.length; i++){

failureItems.push(`<li class="text-warning">${arr[i]}</li>`);

The problem is the quotes ,’’,.
in the question for this code, the required output included the quotes

Ahh, I see now. In the required output, those single quotes mean that the value is a string, but the single quotes themselves are not part of the actual string.

In your working code, you are pushing a string into the array, you don’t need to add those single quotes to make it a string because the backticks already make it a string.

Does that clear up the confusion?


yeah, it does. Thanks a lot, mate!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.