Hey thanx for this. I am new to JS and I hit problem so I need help understanding this while loop.
Could you please help me understand this:
Var number =1; Var sum = 0; While(number < 11){ Sum += number; ++number; } Console.log(sum); //Displays 55
My question is how does it get to 55? I'd appreciate it if you can break it down for this Newby.
Thanx in advance m
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey thanx for this. I am new to JS and I hit problem so I need help understanding this while loop.
Could you please help me understand this:
Var number =1;
Var sum = 0;
While(number < 11){
Sum += number;
++number;
}
Console.log(sum); //Displays 55
My question is how does it get to 55?
I'd appreciate it if you can break it down for this Newby.
Thanx in advance m