Clarification on Loops

Tell us what’s happening:

Quick lesson question: Was just reading about “Condition Statements Loops” and they reminded me of the "While Loop " Function we just learned about in the previous lesson. Can someone point out the differences and when you would want to use one more so over the other because in my head they both appear to do the same job.

The “Condition Statements Loop” checks at the start of the loop and then executes…
While the “While Loop” checks to see if the statement is true and then executes?

Your code so far

// Setup
var myArray = [];

// Only change code below this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36.

Challenge: Iterate with JavaScript For Loops

Link to the challenge:

while loop: “if this condition is true, execute the code in the loop”

for loop:
for (A; B; C) {D}
starts by executing A, then checks if B is true and if it is then goes to D, after that C execute, and B is checked again

A --> B ---true-> D --> C 

do...while loop, execute the code once, then checks the condition and keep working as long as condition is true

these are some of loops in JS

the for loop is usually used if you need a variable to iterate through a string or an array for (var i = 0; i < arr.length; i++) {console.log(arr[i])}