Create Strings using Template Literals https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals

Tell us what’s happening:
is this code wrong?

Your code so far


const result = {
  success: ["max-length", "no-amd", "prefer-arrow-functions"],
  failure: ["no-var", "var-on-top", "linebreak"],
  skipped: ["id-blacklist", "no-dup-keys"]
};
function makeList(arr) {
  "use strict";

  // change code below this line
  const resultDisplayArray = [];
  var i = 0;
  while(i < arr.lenght) {
    resultDisplayArray[i] = `<li class="text-warning">${arr[i]}</li>`;
  };
  // change code above this line

  return resultDisplayArray;
}
/**
 * makeList(result.failure) should return:
 * [ `<li class="text-warning">no-var</li>`,
 *   `<li class="text-warning">var-on-top</li>`, 
 *   `<li class="text-warning">linebreak</li>` ]
 **/
const resultDisplayArray = makeList(result.failure);

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals

1 Like

Which tests aren’t passing?

resultDisplayArray is an array containing result failure messages.

while(i < arr.lenght

already corrected arr.length and still have the same problem.

@freecodecampnewemail,

Hey bud, I just solved this challenge(with the help of other campers of course). you can check how I solved it here: What am I doing wrong: ES6: Create Strings using Template Literals

how i can change i during each iteration?

You need to increment it by one.

1 Like

I can’t imagine how i missed it.
Thank you