I hope YOU guys are doing good
I am learning Javascript
I got to know about “continue” which we can use in loop for iteration.
But here is what i can’t get
First have a look at the code:
let k= 1
do{
if(k===9){
k++;
continue;
}
console.log(k+1);
k++;
}while(k<15);
When in console.log is (k+1)then, 9 is printed and 10 is missed.
Can’t get why?
But when this code is used
let k= 1
do{
if(k===9){
k++;
continue;
}
console.log(k);
k++;
}while(k<15);
When in console.log is (k)then, 9 is not printed and 10 is printed.
Can’t understand the logic behind when simple (k) is used and when (k+1) is used?
Thanks