Why the 2 shows up?


#1


Hi , it's not actually a problem I did pass but when i run the script a 2 shows up , can you tell me why ?

https://www.codecademy.com/en/courses/javascript-beginner-en-ASGIv/2/4?curriculum_id=506324b3a7dffd00020bf661

No error messages .

var x = 0
//first comes while//
while (x<2){
    console.log("Good job");
    x++
}
//Then we go with for //
for ( x=0 ; x<2 ; x++){
     console.log("Good job");
}
//Finally do/while //
do {
     console.log("Good job");
     x++
}
while(x<2)


#2

It may be displaying the final value of x


#3

I see thanks for your reply ^^


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.