What wrong with my code...introduction while loops11//11


#1

for( var i=1; i<3; i++) {
console.log(i);
}
var Iam = true;

while(Iam==true ){

Iam = false;
console.log("I'm learning while loops!");

}
var j = 1;
do {
j++;
console.log(i);
} while (j < 5);

Result:
1
2
I'm learning while loops!
3
3
3
3


#2

getting 3333 instead of 2345


#3

First let's create the for loop:

for (countOne = 1; countOne < 15; countOne++){
    console.log("Java Bunny is " + countOne + " old.")
}

While loop:

var javaBunnyTwo = 14;

var funcOne = function(javaBunnyTwo){
    while(javaBunnyTwo){
        console.log("Java Bunny is fourteen years old.");
        javaBunnyTwo = false;
    }
}

funcOne(javaBunnyTwo);

Do loop:

var javaBunnyThree = false;

do{
    console.log("Java Bunny is young, don't you think?");
} while(javaBunnyThree);

#4

Well the counting variable of your while loop is j but what you print is i (the counting variable of your for loop which stopped at 3).