ES6: Create Strings using Template Literals - Get this camper unstuck

Tell us what’s happening:

Hello FCCampers! I have been stuck here for a day and a half now and I am trying to understand what I am doing wrong. My answer keeps returning 3 undefined rather than the values in the array. If you could point me in the right direction I’ll be very grateful :slight_smile: I have two friends with me trying to complete it to see if they can tell me where I am going wrong :smiley: So far no luck! :stuck_out_tongue: I looked around the forum but people are using the arrow function which I am not, and while I understand (or think I understand) their answers, I am not quite sure why mine is giving different results.

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 = arr.map(function(value){
   `<li class="text-warning">${value}</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 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36.

Challenge: Create Strings using Template Literals

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

SOLVED Of course the minute I ask the question I solved it :slight_smile: For anyone looking at this, I was missing the return.

1 Like