Loops

for(initialization; condition; iteration){
statement
}

for(let i = 1; i <= 3; i++){
console.log(i)
}
//output: 1, 2, 3
while(condition){
statement
}
let i = 1
while(1 <= 3){
console.log(i)
i++
}
//output: 1, 2, 3
do{
statement
}while(condition)
i = 1
do{
console.log(i)
i++;
}while (i <= 3);

// output: 1, 2, 3

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store