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 = [`<li class="text-warning">${arr}</li>`];
//console.log(failureItems);
// Only change code above this line
return failureItems;
}
const failuresList = makeList(result.failure);
the line const failureItems = [`<li class="text-warning">${arr}</li>`]; is wrong because it will return ["no-var", "var-on-top", "linebreak"]
and the challenge is to return [ '<li class="text-warning">no-var</li>', '<li class="text-warning">var-on-top</li>', '<li class="text-warning">linebreak</li>' ]
The solution i have written is
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
var failureItems =[];
arr.forEach((e)=>{
failureItems.push( `<li class="text-warning">${e}</li>`);
})
// Only change code above this line
console.log(failureItems)
return failureItems;
}
const failuresList = makeList(result.failure);
@DaniyaTheDeveloper I have blurred your code and removed the two fCC solutions you posted. People can use the hint thread if they want to see the solutions.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.