Create$Strings$using Template Literals

When i try using while loop for this challenge, i get a potential infinite loop warning?

  **Your code so far**

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

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

// Only change code above this line

return failureItems;

const failuresList = makeList(result.failure);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0

Challenge: Create Strings using Template Literals

Link to the challenge:

Make sure to define your variables

i++ has to be inside the while loop and you have to declare i

1 Like