Jump to content

Can you wizards help this nice lady?


G+_George Kozi
 Share

Recommended Posts

Writing_a_while_statement.jpg

Can you wizards help this nice lady?

 

Originally shared by Meg Tufano

 

I'm trying to learn code all by myself (poor me (and a good way to avoid thinking about politics)) and would like to crowdsource the following Javascript question because I don't understand the right answer:

 

Question: What does the alert statement display in the following code:

 

var x = 45; while (x>2) {x- - ;} alert(x);

 

The course says the answer is 2.

 

That makes no sense to me. I think it should be 3.

 

Why is it 2?

 

Or is the course wrong?

 

HELP!!!!!!!!!

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...