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";
for (var i = 0; i < result.failure.length; i++) {
const resultDisplayArray = `<li class="text-warning">${result.failure[i]}</li>`;
// change code above this line
return resultDisplayArray;
I feel so close to getting this but the loop isn’t printing out the rest of the elements in the result.failure array. Got any clues as to why? I did look up some solutions but most people used the map function.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
Parameter arr is never referenced. Either remove it and continue referencing result.failure or change your references to result.failure to arr. This isn’t causing you’re issue, but could cause a debugging difficulty down the line.
return is ending the for loop and existing the function.
P.S. Also, you should put “use strict” at the top of your file.