A for-of loop is like a for loop that specializes in iterating through iterable bodies. Iterating through iterable bodies is a very common programming practice, so, having a dedicated loop for it can be very useful.
// Using the traditional for-loopiterable = [11,22,33,44,55]for(let i =0; i<iterable.length; i+=1){console.log(iterable[i])}
Another loop that does a very similar job is the for-in loop. However, it is very important that you do not confuse them.
// Using the for-in loopiterable = [11,22,33,44,55]for(let index in iterable) // The for-in loop{console.log(index) // prints the indices rather than elements}
Free Resources