ES6Create Strings using Template Literals

So I’m trying to iterate(loop) through failure but not sure how i would access failure property through the loop. I’m trying to break this problem down and do the loop first. Any help would be great thanks


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 = [];
// 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/88.0.4324.190 Safari/537.36.

Challenge: Create Strings using Template Literals

Link to the challenge:

The arr argument is the is already the array you want so you can just work with it, and from there a good method for you to use would be map in conjunction with the template literal.

function makeList(arr) {
console.log(arr) //["no-var", "var-on-top", "linebreak"]
return failureItems;
}

am i suppose to create a new array with the template literals or just push it back into failureItems ?

you want to return a new array

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.