Not able understanding

Tell us what’s happening:
i am not able to understand this code !!!Please healp!!

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 = [${result.failure.[0]},];
// Only change code above this line

return failureItems;
}

const failuresList = 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/86.0.4240.75 Safari/537.36 Edg/86.0.622.38.

Challenge: Create Strings using Template Literals

Link to the challenge:

Have you come across Array’s Map method? This could come in handy.

For example if you have an array of ["Man", "Woman", "Neutral"] that you want to map in an array of objects with the following properties: {gender: "Man", type: "Human"}, you can do it like this:

["Man", "Woman", "Neutral"].map((item) => { return {gender: item, type: "Human"} });

//outputs
[ {gender: "Man", type: "Human"}, {gender: "Woman", type: "Human"}, {gender: "Neutral", type: "Human"}]

Edit: If you don’t know Map yet, w3schools can help: https://www.w3schools.com/jsref/jsref_map.asp

I hope you get something out of it. Keep struggling! It’s the best way to learn.

1 Like

you need to loop over arr and put <li> elements in failureitems using template literals.

something like

    failureItems.push(`<li class="text-warning">${arr[i]}</li>`)