JavaScript 008 – Loops For, While, For…In

All the programming languages supports Loops. Loops run the block of code repeatedly to achieve some goal. For example, let us say you have 1000 students’ height in an array, and you want to calculate average student height. Here, a loop is required to read each student’s height and perform a running count. At the end of the loop, we can calculate the average as we have total height and total number of students. In these JavaScript examples, we will learn the looping techniques.