Unable to print using do /while code


#1

Hi,
In the section: 11 Review, I have written the following code:

// Write your code below!
j = 1
for (i = 1; i < 3; i++){
    console.log("For loop mastery" +" "+ i );
    }
while (j < 3){
    console.log("While loop mastery" +" "+ j );
    j++
    }
do {
    console.log("Do /While loop mastery" +" "+ j );
    
    } while (j < 3){
        j++
    };

and the output is:

For loop mastery 1
For loop mastery 2
While loop mastery 1
While loop mastery 2
Do /While loop mastery 3
3

While the for ad while loop output is expected outcome - do/while output is not.
I expected the output would be

Do /While loop mastery 1
Do /While loop mastery 2
Do /While loop mastery 3

can someone please help me better understand the do / while loops?


#2

@sureshdev,
Maybe you should read...

The Instructions:
To finish up and prove your loop mastery,
write three syntactically correct loops in the editor:
one for,
one while, and one do. Beware of infinite loops!

the for-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for

the while-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while

the do-while-loop:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while