In the Create Strings using Template Literals ES6 lesson, I understand that we have to include a loop. but I don’t understand why we have to include arr.length.
Also, what are we pushing into failureItems exactly? I’m especially confused by the part below. Could someone explain this in a simple way?
This lesson is taking what you learned in the Javascript Basics about loops, and applying it to some HTML elements. You are iterating through the arr[] using a for loop which looks like most for loops do, and you are using arr.length because that is the conditional statement for the loop. You don’t want the for loop to iterate more times than there are arguments, right? That would break your code. If you need a refresher, go back and look at some of the lessons on loops in Javascript Basics, they are simpler and the logic can be broken down quite easily. I hope this helps