For of loop problem

I looped through the result.failure array and I got values,but when I use it in the template literal I am getting same value from the array.I want to get three different values with pos variable,can someone tell me

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
  let pos;
  for( pos of result.failure){
    console.log(pos);
  }
  
  const resultDisplayArray = [`<li class="text-warning">${pos}</li>`,
`<li class="text-warning">${pos}</li>`,
`<li class="text-warning">${pos}</li>`];
  // change code above this line
  return resultDisplayArray;
}
/**
 * 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);


console.log(resultDisplayArray);

You have declared pos above the loop, then loop through result.failure, only logging it as you go, then declare your array after exiting the loop, using the last known value of pos. You need to push each item of the array individually while inside the loop.

If you use the .map method on result.failure, then makeList can be done in one line of code.