Why do I get a TypeError?

I searched it and found that something in my code must be undefined but I can’t figure out what and why.

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
    for (let i = 0; i < arr.length; i++) {
    failureItems.push(`<li class="text-warning">${arr[i]}</li>`)

const failureItems = [];
// Only change code above this line

return failureItems;

const failuresList = makeList(result.failure);

Link to the challenge:

I found the mistake!

I wrote the for loop above the assignment of the failureItmems array. It should be below!