Create Strings using Template Literals " resultDisplayArray is the desired output"

Create Strings using Template Literals " resultDisplayArray is the desired output"
0

#1

Tell us what’s happening:

" resultDisplayArray is the desired output" <— I do not get this criteria. I thought I returned resultDisplayArray as array with the template literal list. What am I missing here? Thanks in advance.

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
  let resultDisplayArray = [];
   for(let i = 0;  i < arr.length; i++){
   resultDisplayArray.push(`<li class = "text-warning">${arr[i]}</li>`);
   }
  
  // change code above this line

  return resultDisplayArray;
}

console.log(makeList(result.skipped));
/**
 * 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/68.0.3440.106 Safari/537.36.

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


#2

You don’t want to do this because it will just console out failure array. You want ton console lot resultDisplayArray at the very bottom to see what’s going on.

But the rest of your code looks good. There is a bug in this exercise that won’t let you pass the 2nd test. Skip this exercise and come back later.


#3

You’ve essentially got it, but the test is sensitive to spaces in the result, so take a look at your output versus what it’s asking for as output and try running it again.


#4

Oh, ok. Thank you. I was begging to wonder lol!


#5

Ok, this one requires a loop and use of the array parameter. Thanks, saw a lot of posts on the forum about this being a bug since we solved this one using other means, but wasn’t passing the tests.