FreeCode test seems to be incorrcct

I’m trying to complete https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals but test #2 says my output isn’t correct but on examination they seem identical.
assigned output:

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

My console output:

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

How do I report this bug?

I’m trying to complete https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals but test #2 says my output isn’t correct but on examination they seem identical.
assigned output:

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

My console output:

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

How do I report this bug?

Could you share your full code with us?

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 = [];
  arr.forEach(element => failureItems.push(`<li class="${element}">${element}</li>`));
  // Only change code above this line

  return failureItems;
}

const failuresList = makeList(result.failure);
console.log(failuresList);

Ah, you are not quite matching the expected output.

Here is the expected output:

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

Here is your output:

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

You are close, but there is a key difference between these two. :slightly_smiling_face:

Ok, for some reason the test prompt was returning the classes that I used making it seem that is what it wanted. This is an easy fix.

Hey there,

For future posts, if you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like