ES6 - Create Strings using Template Literals

Tell us what’s happening:

Console
// running tests

  1. failuresList should be an array containing result failure messages.
    // tests completed

Cannot complete the challenge, I suspect the , is missing to separate the array items? Any clue how to fix?

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

  return failureItems;
}

const failuresList = makeList(result.failure);

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1 Ddg/18.3

Challenge Information:

ES6 - Create Strings using Template Literals

how to debug:

add console.log(failuresList) as last line, it shows an empty array
so let’s move inside the function

let’s check console.log(failureItems) inside the function before returning, also empty array
so now let’s add a console.log(n) inside the loop, no sign of life

so now let’s check all the things that make the loop before the loop, in this case:

check what the value of this is, you have a typo

Thanks for the help!