Why is a need to
const resultDisplayArray = makeList(result.failure); ?
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 = []; // I get that we need to create a blank array to output.
for (let i=0; i< arr.length; i++) { // The loop to look through the object.
resultDisplayArray.push(`<li class="text-warning">${arr[i]}</li>`); // This to push the protpertyy requested by the function parameter.
}
// change code above this line
return resultDisplayArray; // This will return the request poperty.
}
/**
* 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);//** THE CONFUSING part is this. Why do I need to assign the functon to this varible? */
console.log(makeList(result.failure))
Cheers!