ES6 - Create Strings using Template Literals

Tell us what’s happening:
No idea what I’m doing, can someone help point me in the right direction? I feel like I was told to know the alphabet after listening to abc by Jackson 5

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 (
  `'<li class="text-warning">${no-var}</li>',
  '<li class="text-warning">${var-on-top}</li>',
  '<li class="text-warning">${linebreak}</li>'`)
  // Only change code above this line

  return failureItems;
}

const failuresList = makeList(result.failure);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: ES6 - Create Strings using Template Literals

Link to the challenge:

You may want to think about the order of your actions, and what failureItems becomes after your actions. In your code, failureItems remains an empty array, you never changed it. Also I am not sure about your for loop, there is not iteration happening. You dont want to hard code the array items

you have to use for loop to print

  • n times for reducing to write code multiple times and you write
  • string many times and bad thing is you wrote it in place of for loop condition. here is the solution - - -

    // change code below this line
      const failureItems = [];
      for (let i = 0; i < arr.length; i++) {
        failureItems.push(`<li class="text-warning">${arr[i]}</li>`);
      }
      // change code above this line
    
  • This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.