ES6 - Create Strings using Template Literals

Tell us what’s happening:
Hello code lovers,
I wonder why my code was rejected.

my console output is here:

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

and expected log here:

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

there is an only difference between them that is:
My output has " ' ' "separators. Actually Idk why they are here.

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++)
{
  let failureMessage = arr[i];
  let warningTxt = `'<li class="text-warning">${failureMessage}</li>'`
  failureItems.push(warningTxt);
}
// Only change code above this line

return failureItems;
}

const failuresList = makeList(result.failure);

console.log(failuresList);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Challenge: ES6 - Create Strings using Template Literals

Link to the challenge:

the strings should not contain single quotes, why do you have quotes at the beginnign and end of your strings?

1 Like

yeah, It is solved when I delete single quotes contained in the “warningTxt” variable.
Thanks for your time.