1-
Looping control flow allows us to go back to some point in the program where we were before and repeat it with our current program state until the requirement is met and then it exits or let program proceed ahead.
2-
Its repetition of a statement (a single thing) until certain criteria is fulfilled or certain requirement is met or certain state is achieved. Its like type 1 and add 1 in previous number and throw result and keep doing it until we reach number 10. And if 10 is thrown then do exit this loop and proceed with the rest of the code. Its a check point where certain task is repeated until desired result, before proceeding.
3-
The difference is in when the condition gets evaluated. In a do loop, the condition is not evaluated until the end of each loop.Do loop will be executed at least once but while loop will check the condition first and then it may or may not get executed depending on the condition.
While loop saves time.
while loop
var number = 0;
while (number <= 12) {
console.log(number);
number = number + 2;
}
do loop
A do loop always executes its body at least once.
var number = 0;
do {
number = number + 2;
console.log(number);
}
while (number <= 10);
4-
Indentation is the increase or decrease of space between the left and right margin (space) of a paragraph or line or statements so that code hierarchy make sense and code becomes more readable.